1)function first(k,l,m,n:integer):boolean;
begin
if (((k mod 2=0) and (l mod 2<>0)) or ((l mod 2=0) and (k mod 2<>0)))=(((m mod 2=0) and (n mod 2<>0)) or ((n mod 2=0) and (m mod 2<>0))) then first:=true else first:=false;
end;
2)function second(k,l,m,n:integer):boolean;
begin
if (k=m) or (l=n) or (((k+1)=m) and ((l+1)=n)) or (((k+2)=m) and ((l+2)=n)) or (((k+3)=m) and ((l+3)=n)) or (((k+4)=m) and ((l+4)=n)) or (((k+5)=m) and ((l+5)=n)) or (((k+6)=m) and ((l+6)=n)) or (((k-1)=m) and ((l-1)=n)) or (((k-2)=m) and ((l-2)=n)) or (((k-3)=m) and ((l-3)=n)) or (((k-4)=m) and ((l-4)=n)) or (((k-5)=m) and ((l-5)=n)) or (((k-6)=m) and ((l-6)=n)) or (((m+1)=k) and ((n+1)=l)) or (((m+2)=k) and ((n+2)=l)) or (((m+3)=k) and ((n+3)=l)) or (((m+4)=k) and ((n+4)=l)) or (((m+5)=k) and ((n+5)=l)) or (((m+6)=k) and ((n+6)=l)) or (((m-1)=k) and ((n-1)=l)) or (((m-2)=k) and ((n-2)=l)) or (((m-3)=k) and ((n-3)=l)) or (((m-4)=k) and ((n-4)=l)) or (((m-5)=k) and ((n-5)=l)) or (((m-6)=k) and ((n-6)=l)) or (((k-1)=m) and ((l+1)=n)) or (((k-2)=m) and ((l+2)=n)) or (((k-3)=m) and ((l+3)=n)) or (((k-4)=m) and ((l+4)=n)) or (((k-5)=m) and ((l+5)=n)) or (((k-6)=m) and ((l+6)=n)) or (((k-1)=m) and ((l+1)=n)) or (((k-2)=m) and ((l+2)=n)) or (((k-3)=m) and ((l+3)=n)) or (((k-4)=m) and ((l+4)=n)) or (((k-5)=m) and ((l+5)=n)) or (((k-6)=m) and ((l+6)=n)) or (((m-1)=k) and ((n+1)=l)) or (((m-2)=k) and ((n+2)=l)) or (((m-3)=k) and ((n+3)=l)) or (((m-4)=k) and ((n+4)=l)) or (((m-5)=k) and ((n+5)=l)) or (((m-6)=k) and ((n+6)=l)) or (((m-1)=k) and ((n+1)=l)) or (((m-2)=k) and ((n+2)=l)) or (((m-3)=k) and ((n+3)=l)) or (((m-4)=k) and ((n+4)=l)) or (((m-5)=k) and ((n+5)=l)) or (((m-6)=k) and ((n+6)=l)) then second:=true else second:=false;
end;