function Max(a, b, c: integer): integer;
var
m: integer;
begin
if a > b then
m := a
else
m := b;
if c > m then
m := c;
Max := m;
end;
function Min(a, b, c: integer): integer;
var
m: integer;
begin
if a < b then
m := a
else
m := b;
if c < m then
m := c;
Min := m;
end;
procedure Swap(var a, b: integer);
var
t: integer;
begin
t := a;
a := b;
b := t;
end;
var
a, b, c, t: integer;
begin
Write('Введи через пробел три числа: ');
Read(a, b, c);
Writeln('Max = ', Max(a, b, c), ', min = ', Min(a, b, c));
if b > a then
Swap(a, b);
if c > b then
begin
Swap(b, c);
if b > a then
Swap(a, b);
end;
Writeln(a, ' ', b, ' ', c);
end.