#include #define syosu(x) fixed< P; typedef pair pdd; typedef pair pll; typedef vector vi; typedef vector vvi; typedef vector vd; typedef vector vvd; typedef vector vl; typedef vector vvl; typedef vector vs; typedef vector

vp; typedef vector vvp; typedef vector vpll; typedef pair pip; typedef vector vip; const ll INF=1ll<<60; const double pi=acos(-1); const double eps=1e-8; const ll mod=1e9+7; const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1}; int n,m,q; set

st; vi s,t,a; vvi g; void dfs(int v,int c){ if(a[v]!=-1) return; a[v]=c; for(auto u:g[v]) if(a[u]==-1) dfs(u,c); } int main(){ cin>>n>>m>>q; g=vvi(n); a=vi(n,-1); s=t=vi(q); for(int i=0;i>u>>v; u--;v--; st.insert({u,v}); } for(int i=0;i>u>>v; u--;v--; st.erase({u,v}); s[i]=u,t[i]=v; } for(auto i=st.begin();i!=st.end();i++){ int u=i->first,v=i->second; g[u].push_back(v); g[v].push_back(u); } dfs(0,0); for(int i=1;i<=q;i++){ int u=s[q-i],v=t[q-i]; g[u].push_back(v); g[v].push_back(u); if(a[u]!=-1||a[v]!=-1){ dfs(u,i);dfs(v,i); } } for(int i=1;i