#include #define endl '\n' using namespace std; const int MAXN=205; int n; int ans[MAXN][MAXN]; int ptr=1; int g4[4][4]={0,0,1,1, 0,2,2,1, 3,2,-1,4, 3,3,4,4}; int g5[5][5]={0,1,1,2,2, 0,0,1,3,2, 4,4,3,3,5, 4,6,7,5,5, 6,6,7,7,-1}; int g7[7][7]={0,0,1,2,2,3,3, 0,4,1,1,2,5,3, -1,4,4,6,5,5,7, 8,9,9,6,6,7,7, 8,8,9,10,10,11,11, 12,13,13,14,10,11,15, 12,12,13,14,14,15,15}; int g9[9][9]={0, 0, 2, 2, 3, 4, 4, 5, 5, 0, 1, 2, 3, 3, 4, 6, 5, 7, 1, 1, 8, 9, 9, 6, 6, 7, 7, 10, 8, 8,11, 9,12,12,14,14, 10,10,11,11,13,13,12,15,14, 17,17,18,21,21,13,15,15,16, 17,18,18,21,23,23,25,16,16, 19,20,20,22,23,24,25,25,26, 19,19,20,22,22,24,24,26,26}; void fill6(int s) { for(int i=1;i<=6*s;i+=3) { for(int j=1;j<=6*s;j+=2) { ans[i][j]=ans[i+1][j]=ans[i][j+1]=ptr++; ans[i+1][j+1]=ans[i+2][j]=ans[i+2][j+1]=ptr++; } } } void fin1(int n) { for(int j=1;j>t; while(t--) { cin>>n; solve(n); } return 0; }