## 页面导航

#include<bits/stdc++.h>
using namespace std;

int q,mp[15][15]={
5 ,4 ,3 ,2 ,1 ,2 ,3 ,4 ,5 ,
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
6 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,6 ,
7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
17,17,17,17,17,17,17,17,17,
16,0 ,0 ,0 ,0 ,0 ,0 ,0 ,16,
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
15,14,13,12,11,12,13,14,15,
};
int turn=0,gv=0,x,y,xx,yy;

bool check(){
if(gv||!mp[x][y]||mp[x][y]/10!=turn)return 0;
int p=mp[x][y]%10;
if(p==1)
}

int main(){
scanf("%d",&q);
while(q--){
scanf("%d%d%d%d",&x,&y,&xx,&yy);
if(!check()){puts("Invalid command");continue;}
move();
checkmate();
gameover();
print();
turn^=1;
}
return 0;
}