program ORDER; {$APPTYPE CONSOLE} uses SysUtils, math; var m:byte; i,j,l,k,d:longint; vh,v:text; s:real; A:array [1..101,0..1048576] of longint; begin { TODO -oUser -cConsole Main : Insert code here } assign (vh,'ORDER.dat'); assign (v, 'ORDER.sol'); reset(vh); read (vh,m); for i:=1 to m do begin read (vh,A[i,0]); for j:=1 to A[i,0] do begin read (vh,A[i,j]); end; end; close (vh); k:=0; for i:=1 to m do begin k:=0; for j:=1 to A[i,0]-1 do begin for l:=j+1 to A[i,0] do begin if A[i,j]>A[i,l] then k:=k+1; end; end; A[i,0]:=k; end; for i:=1 to m do begin A[i,0]:=A[i,0] mod 2; end; rewrite (v); s:=0; j:=m mod 4; l:=j; for i:=1 to j do begin s:=s+(A[i,0]*power(10,l-i)); end; k:=trunc(s); if k=1 then write (v,'1') else if k=10 then write (v,'2') else if k=11 then write (v,'3') else if k=100 then write (v,'4') else if k=101 then write (v,'5') else if k=110 then write (v,'6') else if k=111 then write (v,'7') else if k=1000 then write (v,'8') else if k=1001 then write (v,'9') else if k=1010 then write (v,'A') else if k=1011 then write (v,'B') else if k=1100 then write (v,'C') else if k=1101 then write (v,'D') else if k=1110 then write (v,'E') else if k=1111 then write (v,'F'); j:=m div 4; s:=0; for d:=1 to j do begin for i:=l+1 to l+4 do begin s:=s+(A[i,0]*power(10,l+4-i)); end; k:=trunc(s); if k=1 then write (v,'1') else if k=10 then write (v,'2') else if k=11 then write (v,'3') else if k=100 then write (v,'4') else if k=101 then write (v,'5') else if k=110 then write (v,'6') else if k=111 then write (v,'7') else if k=1000 then write (v,'8') else if k=1001 then write (v,'9') else if k=1010 then write (v,'A') else if k=1011 then write (v,'B') else if k=1100 then write (v,'C') else if k=1101 then write (v,'D') else if k=1110 then write (v,'E') else if k=1111 then write (v,'F'); l:=l+4; end; close (v); end.