program P800;
var
s:string;
t,i,j,k,x1,y1,x2,y2:longint;
begin
assign(input,'poj_1657.in');
reset(input);
assign(output,'poj_1657.out');
rewrite(output);
readln(t);
for i:=1 to t do
begin
readln(s);
x1:=ord(s[2])-48;
x2:=ord(s[5])-48;
y1:=ord(s[1])-96;
y2:=ord(s[4])-96;
if (x1=x2)and(y1=y2) then writeln('0 0 0 0') else begin
if abs(x1-x2)>=abs(y1-y2) then write(abs(x1-x2),' ') else write(abs(y1-y2),' ');
if (abs(x1-x2)=abs(y1-y2))or(x1=x2)or(y1=y2) then write('1 ') else write('2 ');
if (x1=x2)or(y1=y2) then write('1 ') else write('2 ');
if ((x1+y1) mod 2)<>((x2+y2) mod 2) then writeln('Inf') else
if (x1-y1=x2-y2)or(x1+y1=x2+y2) then writeln(1) else writeln(2);
end;
end;
end.