program order; {$APPTYPE CONSOLE} var a:array[1..1048576] of integer; b:array[1..100] of byte; i,n,j,k:integer; pr:int64; m:byte; f:text; s,c:string; p:boolean; begin assign(f,'order.dat'); reset(f); readln(f,m); for i:=1 to m do begin read(f,n); for j:=1 to n do begin read(f,a[j]); end; readln(f); pr:=0; for j:=1 to n-1 do begin for k:=j+1 to n do if a[j]>a[k] then pr:=pr+1; end; if ((pr/2)-int(pr/2)=0)then b[100-m+i]:=0 else b[100-m+i]:=1; end; close(f); j:=100; s:=''; while (j<>0) do begin m:=b[j]+b[j-1]*2+b[j-2]*4+b[j-3]*8; j:=j-4; if (m<=9) then begin str(m,c); s:=c+s; end; if (m=10) then s:='A'+s; if (m=11) then s:='B'+s; if (m=12) then s:='C'+s; if (m=13) then s:='D'+s; if (m=14) then s:='E'+s; if (m=15) then s:='F'+s; end; p:=true; while (p) do begin if (s[1]='0')and(length(s)>1) then s:=copy(s,2,length(s)) else p:=false; end; assign(f,'order.sol'); rewrite(f); writeln(f,s); close(f); end.