#include <cstdio>
#pragma warning(disable : 4996)
int n, m, q, a[100009], b[100009], t[100009], x[100009], y[100009], p[100009], f[100009];
int root(int x) { return p[x] == x ? x : p[x] = root(p[x]); }
int main() {
scanf("%d %d %d", &n, &m, &q);
for (int i = 0; i < m; i++) scanf("%d %d", &a[i], &b[i]), a[i]--, b[i]--;
for (int i = 0; i < q; i++) {
scanf("%d %d", &t[i], &x[i]); x[i]--;
if (t[i] == 1) scanf("%d", &y[i]), y[i]--;
else f[x[i]] = 1;
}
for (int i = 0; i < n; i++) p[i] = i;
for (int i = 0; i < m; i++) {
if (!f[i]) p[root(a[i])] = root(b[i]);
}
for (int i = q - 1; i >= 0; i--) {
if (t[i] == 0) p[root(a[x[i]])] = root(b[x[i]]);
else x[i] = (root(x[i]) == root(y[i]));
}
for (int i = 0; i < q; i++) {
if (t[i] == 1) printf(x[i] ? "YES\n" : "NO\n");
}
return 0;
}