#include<bits/stdc++.h>
#include<string>
#define ri register int
#define ll long long
#define mkp make_pair
using namespace std;
const int maxn=5e4+7;
int n,m,q;
int cnt,head[maxn],to[maxn<<1],nxt[maxn<<1];
int d[maxn];
void add(int u,int v){
++cnt;
d[v]++;
to[cnt]=v;
nxt[cnt]=head[u];
head[u]=cnt;
}
struct opt{
int op,u,v;
int id;
}qry[maxn<<1];
vector<pair<int,int> >edge;
const int B=32;
bool tongxing[maxn<<1];
int vis[maxn];
vector<int>pnt;
namespace Small_G{
int ed[65][65];
ll fr[65];
bool vis[65];
void clear(){
memset(ed,0,sizeof(ed));
for(ri i=1;i<=64;i++){
fr[i]=0;
}
}
void change(int u,int v){
ed[u][v]^=1;
}
int n;
bool find(int u,int goal){
if(u==goal)return 1;
vis[u]=1;
// cout<<u<<endl;
for(ri v=1;v<=n;v++){
if(ed[u][v]&&vis[v]){
cout<<"YOUDIE\n";
exit(0);
}
if(ed[u][v]&&!vis[v]){
if(find(v,goal))return 1;
}
}
return 0;
}
bool kd(int u,int v){
memset(vis,0,sizeof(vis));
return find(u,v);
}
}
struct my_queue{
int num[maxn];
int head,tail;
void clear(){
head=1,tail=0;
}
void push(int x){
num[++tail]=x;
}
void pop(){
++head;
}
int front(){
return num[head];
}
bool empty(){
return tail<head;
}
}qq;
ll kd[maxn];
void solve(int l,int r){
// cout<<l<<' '<<r<<endl;
for(ri i=l;i<=r;i++){
vis[qry[i].u]=1;
vis[qry[i].v]=1;
}
pnt.clear();
for(ri i=1;i<=n;i++){
if(vis[i])pnt.emplace_back(i);
}
for(ri i=0;i<pnt.size();i++){
vis[pnt[i]]=i+1;
}
memset(nxt,0,sizeof(nxt));
memset(head,0,sizeof(head));
memset(d,0,sizeof(d));
cnt=0;
for(ri i=0;i<edge.size();i++){
if(tongxing[i]){
add(edge[i].first,edge[i].second);
}
}
qq.clear();
Small_G::clear();
Small_G::n=pnt.size();
for(ri i=1;i<=n;i++){
if(d[i]==0){
qq.push(i);
}
}
memset(kd,0,sizeof(kd));
while(!qq.empty()){
int u=qq.front();qq.pop();
if(vis[u]){
for(ri i=0;i<pnt.size();i++){
if(kd[u]>>i&1){
Small_G::change(i+1,vis[u]);
}
}
kd[u]=1ll<<vis[u]-1;
}
for(ri e=head[u];e;e=nxt[e]){
int v=to[e];
kd[v]|=kd[u];
d[v]--;
if(d[v]==0){
qq.push(v);
}
}
}
for(ri i=l;i<=r;i++){
if(qry[i].op==1){
Small_G::change(vis[qry[i].u],vis[qry[i].v]);
tongxing[qry[i].id]^=1;
}
else {
cout<<(Small_G::kd(vis[qry[i].u],vis[qry[i].v])?"YES":"NO")<<endl;
}
}
memset(vis,0,sizeof(vis));
}
namespace PanHuan{
int cnt,head[maxn],to[maxn<<1],nxt[maxn<<1];
int d[maxn];
void add(int u,int v){
++cnt;
d[v]++;
to[cnt]=v;
nxt[cnt]=head[u];
head[u]=cnt;
}
void panhuan(){
queue<int>q;
for(ri i=1;i<=n;i++){
if(!d[i]){
q.push(i);
}
}
while(!q.empty()){
int u=q.front();
q.pop();
for(ri e=head[u];e;e=nxt[e]){
int v=to[e];
d[v]--;
if(d[v]==0)q.push(v);
}
}
for(ri i=1;i<=n;i++){
if(d[i]){
cout<<"YOUDIE\n";
exit(0);
}
}
}
}
signed main(){
ios::sync_with_stdio(0);
cin>>n>>m>>q;
for(ri i=1;i<=m;i++){
int u,v;
cin>>u>>v;
Panhuan::add(u,v);
edge.emplace_back(mkp(u,v));
}
Panhuan::panhuan();
memset(tongxing,1,sizeof(tongxing));
for(ri i=1;i<=q;i++){
cin>>qry[i].op;
if(qry[i].op==1){
cin>>qry[i].id;
qry[i].id--;
qry[i].u=edge[qry[i].id].first;
qry[i].v=edge[qry[i].id].second;
}
else{
cin>>qry[i].u>>qry[i].v;
}
}
for(ri i=1;i<=q/B;i++){
solve((i-1)*B+1,i*B);
}
if(q%B)solve(q/B*B+1,q);
return 0;
}
/*
5 6 7
1 2
1 3
2 4
3 4
3 5
4 5
2 1 5
2 2 3
1 3
1 4
2 1 4
1 3
2 1 5
*/