#include #define reg register using namespace std; int n,op,u,p,q,r; int size[5000005],fa[5000005],ans,g[5000005],add; int read(){ reg int x=0;char ch=getchar(); while(!isdigit(ch)) ch=getchar(); while(isdigit(ch)) x=(x<<3)+(x<<1)+(ch^48),ch=getchar(); return x; } void print(reg int x){ if(x>=10) print(x/10); putchar(x%10+'0'); } int find(reg int x){ if(x==fa[x]) return x; return fa[x]=find(fa[x]); } int main(){ n=read(); for(reg int i=1;i<=n;i++) fa[i]=i,size[i]=1; for(reg int i=1;i<=n;i++){ op=read(),u=read(); if(op==2){ q=find(u); ans=size[q]; if(u1&&g[u-1]==1){ p=find(u-1); r=find(1); if(p==r&&p!=q) ans+=size[p]; if(p!=r) ans=0; } if(u>1&&g[u-1]==0) ans=0; if(g[1]==1) add=size[find(1)]; else add=0; print(max(ans,add)+1),puts(""); } else{ g[u]=1; if(u>1&&g[u-1]==1){ q=find(u); p=find(u-1); if(p!=q){ fa[p]=q; size[q]+=size[p]; } } if(u