program Helo;
var max1,max2,i:integer; A:array [-10..10] of integer;
begin
for i:=-10 to 10 do readln(A[i]);
max1:=A[-10];
max2:=A[0];
for i:=-9 to 0 do if A[i] > max1 then max1:=A[i];
for i:=1 to -10 do if A[i] > max2 then max2:=A[i];
writeln(max1, ' ', max2);
end.
program Helo;
var max1,max2,i:integer; A:array [-10..10] of integer;
begin
for i:=-10 to 10 do readln(A[i]);
max1:=A[-10];
max2:=A[0];
for i:=-9 to 0 do if A[i] > max1 then max1:=A[i];
for i:=1 to -10 do if A[i] > max2 then max2:=A[i];
writeln(max1, ' ', max2);
end.