#include<bits/stdc++.h>
using namespace std;
const int N=2e6+5;

int a[2000005];
int s1[N],s2[N],head1=1,head2=1,tail1=0,tail2=0;
int ans[N<<1][3],op=0;
int n,m,k;

namespace baoli{
	int _main_(){
		for(int i=1;i<=m;i++){
			cin>>a[m];
		}
		for(int i=1;i<=m;i++){
			if(a[m]==s1[tail1]){
				op++;
				tail1--;
				ans[op][1]=1;
				ans[op][2]=1;
				
			}
			else if(a[m]==s2[tail2]){
				op++;
				tail2--;
				ans[op][1]=1;
				ans[op][2]=2;
			}
			else if(head1>tail1){
				op++;
				tail1++;
				s1[tail1]=a[m];
				ans[op][1]=1;
				ans[op][2]=1;
			}
			else if(head2>tail2){
				op++;
				tail2++;
				s1[tail2]=a[m];
				ans[op][1]=1;
				ans[op][2]=2;
			}
			else {
				op++;
				tail1++;
				s1[tail1]=a[m];
				ans[op][1]=1;
				ans[op][2]=1;
			}
			if(s1[head1]==s2[head2]){
				op++;
				head1++;
				head2++;
				ans[op][1]=2;
			}
		}
		return 1;	
	}
}

void solve(){
	memset(s1,0,sizeof(s1));
	memset(s2,0,sizeof(s2));
	head1=1,head2=1,tail1=0,tail2=0;
	op=0;
	if(n==2){
		baoli::_main_();	
	}
	int i=1;
	while(ans[i][1]!=0){
		if(ans[i][1]==2){
			cout<<2<<' '<<1<<' '<<2<<endl;
		}
		else cout<<1<<' '<<ans[i][2]<<endl;
	}
}
int main(){
	freopen("meow.in","r",stdin);
    freopen("meow.out","w",stdout);
    int T;
    cin>>T;
    while(T--){
    	solve();
	}
	return 1;
}
