#include<bits/stdc++.h>
#define maxn 1200000
#define N 120000
using namespace std;
char *p1,*p2,buf[100000];
#define nc() (p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++)
int rd() while(c>47) x=(((x<<2)+x)<<1)+(c^48),c=nc(); return x*f;}
void setIO(string s)
{
string in=s+".in";
string out=s+".out";
freopen(in.c_str(),"r",stdin);
freopen(out.c_str(),"w",stdout);
}
struct Union
{
int p[maxn];
inline void init() { for(int i=0;i<maxn;++i) p[i]=i; }
inline int find(int x) { return p[x]==x?x:p[x]=find(p[x]); }
inline int merge(int x,int y)
}con;
struct LCT
inline void pushup(int x)
inline void pushdown(int x)
inline void rotate(int x)
inline void splay(int x)
inline void Access(int x)
{
int t=0;
while(x)
{
splay(x), rson=t, pushup(x), t=x,x=f[x];
}
}
inline void MakeRoot(int x)
{
Access(x), splay(x), mark(x);
}
inline void split(int x,int y)
{
MakeRoot(x), Access(y), splay(y);
}
inline void cut(int x,int y)
{
MakeRoot(x), Access(y), splay(y);
ch[y][0]=f[x]=0;
pushup(y);
}
inline void link(int x,int y)
{
MakeRoot(x), f[x]=y;
}
}tr;
int n,m,Q,eds;
int from[maxn],to[maxn], cap[maxn], answer[maxn];
map<int,int>ck[maxn];
struct OPT
{
int o, x,y,eds, id, ans;
}opt[maxn];
int main()
for(i=1;i<=Q;++i)
}
for(i=1;i<=eds;++i)
}
for(i=Q;i>=1;--i)
if(opt[i].o==2)
else
}
}
}
for(i=1;i<=Q;++i) if(opt[i].o==1) printf("%d
",opt[i].ans);
return 0;
}