var a, b, c, d, min, max: integer;
begin
// Min
readln(a, b, c, d);
if (a <= b) and (a <= c) and (a <= d) then min := a
else if (b <= a) and (b <= c) and (b <= d) then min := b
else if (c <= a) and (c <= b) and (c <= d) then min := c
else if (d <= a) and (d <= b) and (d <= c) then min := d;
// Max
if (a >= b) and (a >= c) and (a >= d) then max := a
else if (b >= a) and (b >= c) and (b >= d) then max := b
else if (c >= a) and (c >= b) and (c >= d) then max := c
else if (d >= a) and (d >= b) and (d >= c) then max := d;
writeln('Min: ', min);
writeln('Max: ', max);
end.
var a, b, c, d, min, max: integer;
begin
// Min
readln(a, b, c, d);
if (a <= b) and (a <= c) and (a <= d) then min := a
else if (b <= a) and (b <= c) and (b <= d) then min := b
else if (c <= a) and (c <= b) and (c <= d) then min := c
else if (d <= a) and (d <= b) and (d <= c) then min := d;
// Max
if (a >= b) and (a >= c) and (a >= d) then max := a
else if (b >= a) and (b >= c) and (b >= d) then max := b
else if (c >= a) and (c >= b) and (c >= d) then max := c
else if (d >= a) and (d >= b) and (d >= c) then max := d;
writeln('Min: ', min);
writeln('Max: ', max);
end.