#include using namespace std; using Int = long long; const char newl = '\n'; template inline void chmin(T1 &a,T2 b){if(a>b) a=b;} template inline void chmax(T1 &a,T2 b){if(a void drop(const T &x){cout< vector read(size_t n){ vector ts(n); for(size_t i=0;i>ts[i]; return ts; } struct UnionFind{ int num; vector rs,ps; UnionFind(){} UnionFind(int n):num(n),rs(n,1),ps(n,0){iota(ps.begin(),ps.end(),0);} int find(int x){ return (x==ps[x]?x:ps[x]=find(ps[x])); } bool same(int x,int y){ return find(x)==find(y); } void unite(int x,int y){ x=find(x);y=find(y); if(x==y) return; if(rs[x]>n>>m>>q; auto ss=read(n); vector> G(n); for(int i=0;i>u>>v; u--;v--; G[u].emplace_back(v); G[v].emplace_back(u); } const int M = 7; UnionFind uf(M*n); auto idx=[&](int i,int j){return j*n+i;}; for(int i=0;i>t>>x>>y; x--;y--; if(t==1){ ss[x][y]='1'; for(int j=0;j