#include<bits/stdc++.h>
using namespace std;
inline int read(){
register int f=1,r=0;register char c=getchar();
while(c>'9'||c<'0'){
if(c=='-'){
f=-1;
}
c=getchar();
}
while(c<='9'&&c>='0'){
r=(r<<1)+(r<<3)-'0'+c;
c=getchar();
}
return f*r;
}
int n,m,q,t;
struct b{
int to,next;
bool life;
}v[500010];
int first[50010];
void push(int i,int x,int y){
v[i].next=first[x];
v[i].to=y;
first[x]=i;
v[i].life=1;
return;
}
int cd[500010];
int main(){
n=read();
m=read();
while(m--){
int x,y;
x=read();
y=read();
push(m+1,x,y);
cd[x]++;
}
q=read();
while(q--){
int x,y;
t=read();
if(t&1){
x=read();
y=read();
}else{
x=read();
}
switch(t){
case 1:
for(int i=first[x];i;i=v[i].next){
if(v[i].to==y){
v[i].life=0;
cd[x]--;
}
}
break;
case 2:
for(int i=1;i<=n;i++){
if(i==x)continue;
for(int j=first[i];j;j=v[j].next){
if(v[j].to==x&&v[j].life==1){
cd[i]--;
v[j].life=0;
break;
}
}
}
break;
case 3:
for(int i=first[x];i;i=v[i].next){
if(v[i].to==y&&v[i].life==0){
v[i].life=1;
cd[x]++;
}
}
break;
case 4:
for(int i=first[x];i;i=v[i].next){
if(v[i].life==0){
v[i].life=1;
cd[x]++;
}
}
for(int i=1;i<=n;i++){
if(i==x)continue;
for(int j=first[i];j;j=v[j].next){
if(v[j].to==x&&v[j].life==0){
cd[i]++;
v[j].life=1;
break;
}
}
}
break;
}
int can=1;
for(int i=1;i<=n;i++){
if(cd[i]!=1){
can=0;
}
}
if(can)cout << "YES";
else cout << "NO";
putchar('\n');
}
}