/* *Author: Hughpig *made in China */ #include using namespace std; #if __has_include() #include using namespace atcoder; #endif #define ll long long #define ld long double #define up(l,r,i) for(int i=(l);(i)<=(r);++i) #define vi vector #define pii pair #define pb push_back #define pob pop_back #define gc getchar #define pc putchar #define il inline #define all(x) x.begin(),x.end() #define reg register #define loop while(1) #define debug cout<<"QwQ\n" #define Sort(a) sort(a.begin(), a.end()) void file(string fl) { freopen((fl+".in").c_str(),"r",stdin); freopen((fl+".out").c_str(),"w",stdout); } il ll read() { char ch=gc(); ll s=0,w=1; while(ch<'0'||ch>'9') { if(ch=='-'){w=-1;} ch=gc(); } while(ch>='0'&&ch<='9') { s=(s<<1)+(s<<3)+ch-48; ch=gc(); } return w*s; } il void write(ll x) { if(x<0) { putchar('-'); x=-x; } if(x>9)write(x/10); putchar(x%10+'0'); } ll ksm(ll a,ll b,ll p) { ll ans=1%p; for(;b;b>>=1){ if(b&1) ans=ans*a%p; a=a*a%p; } return ans; } void ios_optimize(){ios::sync_with_stdio(0);cin.tie(0);} ll ls(ll u){return u<<1;} ll rs(ll u){return u<<1|1;} ll myabs(ll x){return x>0?x:-x;} ll mymax(ll x,ll y){return x>y?x:y;} ll mymin(ll x,ll y){return x > vis; vector G[N]; void merge(int x,int y,int k){ x=fa[x],y=fa[y]; if(x==y)return; if((x>1&&G[x].size()>TestCases; while(TestCases--){ cin>>n>>m>>q; up(1,n,i)fa[i]=i,G[i].pb(i); up(1,m,i){ cin>>u[i]>>v[i]; } up(1,q,i){ cin>>u_[i]>>v_[i]; vis.insert({u_[i],v_[i]}); } up(1,m,i){ if(!vis.count({u[i],v[i]}))merge(u[i],v[i],-1); } for(int i=q;i;--i){ merge(u_[i],v_[i],i); } for(int i=2;i<=n;++i)cout<