#include using namespace std; #define ll long long #define mem(x) memset(x,0,sizeof(x)) #define printYes puts("Yes") #define printYES puts("YES") #define printNo puts("No") #define printNO puts("NO") const ll inf=1000000000000000000; const ll mod=998244353; const int N=5000006; int n,m,T; int fa[N]; inline int read() { int F=1,ANS=0; char C=getchar(); while (C<'0'||C>'9') { if (C=='-') F=-1; C=getchar(); } while (C>='0'&&C<='9') { ANS=ANS*10+C-'0'; C=getchar(); } return F*ANS; } inline char readchar() { char C=getchar(); while (C<33||C>126) C=getchar(); return C; } inline int raed(){return read();} int find(int x) { if (x==fa[x]) return x; return fa[x]=find(fa[x]); } void work() { n=read(); for (int i=1;i<=n+1;i++) fa[i]=i; for (int i=1;i<=n;i++) { int tp=read(),x=read(); if (tp==1) { if (find(x)!=x) continue; fa[x]=x+1; } else { int y=find(1); if (x!=y) printf("%d\n",y); else printf("%d\n",find(y+1)); } } return; } int main() { int tp=1; //0 : many test cases //1 : one test case if (tp==0) T=read(); else T=1; while (T--) { work(); } return 0; }