Program ideone;
Var min1, min2, A, A1, B, B1, C, C1 : integer;
Function min(Var a, b, c : integer) : integer;
begin
if (aelse if belse min := c;
end;
Procedure max(Var a, b : integer);
begin
if (a>b) then writeln(a)
else writeln(b);
end;
begin
read(A, B, C, A1, B1, C1);
min1 := min(A, B, C);
min2 := min(A1, B1, C1);
max(min1, min2);
end.