#!/usr/bin/env python
# Sort 4 numbers
# Yotam Medini  yotam.medini@gmail.com -- 2007/June/10

import sys

rc = 0
if len(sys.argv) != 1 + 4:
    rc = 1
    sys.stderr.write("Usage: %s <n1> <n2> <n3> <n4>\n" % 
                     sys.argv[0])
    sys.exit(1)

x1 = int(sys.argv[1])
x2 = int(sys.argv[2])
x3 = int(sys.argv[3])
x4 = int(sys.argv[4])

# Change places, so  x4  will hold the maximum
if x1 > x2:
    t = x1
    x1 = x2
    x2 = t
if x2 > x3:
    t = x2
    x2 = x3
    x3 = t
if x3 > x4:
    t = x3
    x3 = x4
    x4 = t
# Now  x1,x2,x3 <= x4.  So we do not change x4 anymore.

# Change places, so  x3  will be the largest before x4
if x1 > x2:
    t = x1
    x1 = x2
    x2 = t
if x2 > x3:
    t = x2
    x2 = x3
    x3 = t
# Now  x1,x2 <= x3 <= x4.  So we do not change x2 anymore.

# Make sure x1 <= x2
if x1 > x2:
    t = x1
    x1 = x2
    x2 = t

# Now  x1 <= x2 <= x3 <= x4
sys.stdout.write("%d %d %d %d\n" % (x1, x2, x3, x4))
sys.exit(0)
