1
#include <bits/stdc++.h>
using namespace std;
int t;
int a;
int x;
int y;
int tree[5][5];
int f;
int k=2;
int cnt;
int x_;
int dot(){
while(k){
memset(tree,0,sizeof(tree));
cnt=0;
while(cnt<9){
x=k;
y=2;
x_=k/3*3;
cout<<x<<" "<<y<<endl;
cin>>x;
cin>>y;
if(x==0&&y==0){
return 0;
}
if(x==-1&&y==-1){
f=1;
return 0;
}
if(tree[x-x_][y]==0){
cnt++;
}
tree[x-x_][y]=1;
}
k+=3;
}
}
int main(){
cin>>t;
while(t--){
cin>>a;
dot();
if(f){
return 0;
}
}
}