intread(){ int s = 0,ne = 1; char c = getchar(); while(c < '0' || c > '9') ne = c == '-' ? -1 : 1, c = getchar(); while(c >= '0' && c <= '9') s = (s << 1) + (s << 3) + c - '0', c = getchar(); return s * ne; }
classDSU { public: int fa[CN]; DSU() {for(int i = 1; i <= 100000; i++) fa[i] = i;} intfd(int x){return fa[x] ^ x ? fa[x] = fd( fa[x] ) : x;} } C;
int n, m, q; vector<int> v[CN];
intmain() { // freopen("_in.in", "r", stdin);
n = read(), m = read(), q = read(); while(m--){ int x = read(), y = read(); v[x].push_back(y), v[y].push_back(x); }
while(q--){ int x = read(), y = read(), fx = C.fd(x), fy = C.fd(y); if(fx == fy) {putchar('1'); continue;}
int szx = v[fx].size(), szy = v[fy].size(); if(szx > szy) swap(fx, fy), swap(szx, szy); bool flag = true; for(int i = 0; i < szx && flag; i++) if(C.fd( v[fx][i] ) == fy) flag = false; if(!flag) {putchar('0'); continue;} putchar('1'); /* fx -> fy */ C.fa[fx] = fy; for(int i = 0; i < szx; i++){ int u = v[fx][i], p = lower_bound(v[fy].begin(), v[fy].end(), u) - v[fy].begin() - 1; if(v[fy][p] == u) continue; v[fy].insert(lower_bound(v[fy].begin(), v[fy].end(), u), u); } } }