Const
lim=2000000;
var
d,max,min:longint;
f:Text;
begin
Assign(f,'input.txt'); Reset(f);
max:=-lim; min:=lim;
while not Eof(f) do begin
Readln(f,d);
if (d>0) and (d mod 2=0) then
if max else if min>d then min:=d;
end;
Close(f);
Assign(f,'output.txt'); Rewrite(f);
if min<>lim then Writeln(f,min,' ',max);
Close(f);
end.