//#pragma comment(linker, "/STACK:1024000000,1024000000") #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; const int maxn=40200; const int INF=999999999; const float eps = 0.00000001; //const int mod=1000000007; const int mod=10000; const int VM=520; const int EM=500020; const int N=999999; typedef pair P; //int dir[4][2]={{-1,0},{1,0},{0,-1},{0,1}}; //int dir[4][2]={{0,1},{0,-1},{-1,0},{1,0}}; int dir[4][2]={{1,0},{0,-1},{-1,0},{0,1}}; /** */ int a[120000]; int main(){ //freopen("input.txt","r",stdin); //freopen("out.txt","w",stdout); int n; int t; scanf("%d",&t); while(t--){ scanf("%d",&n); int flag0=0,flag1=0; for(int i=0;i