heap = []
while True:
    try:
        n = int(raw_input())
        if len(heap) == 0:
            heap.append(n)
        elif len(heap) == 1:
            if n <= heap[0]:
                heap.append(n)
            else:
                heap.insert(0, n)
        elif len(heap) == 2:
            if n > heap[0]:
                heap.insert(0, n)
            elif n <= heap[1]:
                heap.append(n)
            else:
                heap.insert(1, n)
        elif n > heap[2]:
            if n >= heap[0]:
                heap.insert(0, n)
            elif n >= heap[1]:
                heap.insert(1, n)
            else:
                heap.insert(2, n)
            heap.pop()
    except (EOFError):
        break
for num in heap:
    print num heap = [] heap [] while True:
    try:
        n = int(raw_input())
        if len(heap) == 0:
            heap.append(n)
        elif len(heap) == 1:
            if n <= heap[0]:
                heap.append(n)
            else:
                heap.insert(0, n)
        elif len(heap) == 2:
            if n > heap[0]:
                heap.insert(0, n)
            elif n <= heap[1]:
                heap.append(n)
            else:
                heap.insert(1, n)
        elif n > heap[2]:
            if n >= heap[0]:
                heap.insert(0, n)
            elif n >= heap[1]:
                heap.insert(1, n)
            else:
                heap.insert(2, n)
            heap.pop()
    except (EOFError):
        break True try:
        n = int(raw_input())
        if len(heap) == 0:
            heap.append(n)
        elif len(heap) == 1:
            if n <= heap[0]:
                heap.append(n)
            else:
                heap.insert(0, n)
        elif len(heap) == 2:
            if n > heap[0]:
                heap.insert(0, n)
            elif n <= heap[1]:
                heap.append(n)
            else:
                heap.insert(1, n)
        elif n > heap[2]:
            if n >= heap[0]:
                heap.insert(0, n)
            elif n >= heap[1]:
                heap.insert(1, n)
            else:
                heap.insert(2, n)
            heap.pop()
    except (EOFError):
        break except (EOFError):
        break break n = int(raw_input()) n int(raw_input()) int raw_input() raw_input if len(heap) == 0:
            heap.append(n)
        elif len(heap) == 1:
            if n <= heap[0]:
                heap.append(n)
            else:
                heap.insert(0, n)
        elif len(heap) == 2:
            if n > heap[0]:
                heap.insert(0, n)
            elif n <= heap[1]:
                heap.append(n)
            else:
                heap.insert(1, n)
        elif n > heap[2]:
            if n >= heap[0]:
                heap.insert(0, n)
            elif n >= heap[1]:
                heap.insert(1, n)
            else:
                heap.insert(2, n)
            heap.pop()
     len(heap) == 0 len(heap) len heap 0 heap.append(n) heap.append heap append n elif len(heap) == 1:
            if n <= heap[0]:
                heap.append(n)
            else:
                heap.insert(0, n)
         len(heap) == 1 len(heap) len heap 1 if n <= heap[0]:
                heap.append(n)
            else:
                heap.insert(0, n)
         n <= heap[0] n heap[0] heap 0 heap.append(n) heap.append heap append n heap.insert(0, n) heap.insert heap insert 0 n elif len(heap) == 2:
            if n > heap[0]:
                heap.insert(0, n)
            elif n <= heap[1]:
                heap.append(n)
            else:
                heap.insert(1, n)
         len(heap) == 2 len(heap) len heap 2 if n > heap[0]:
                heap.insert(0, n)
            elif n <= heap[1]:
                heap.append(n)
            else:
                heap.insert(1, n)
         n > heap[0] n heap[0] heap 0 heap.insert(0, n) heap.insert heap insert 0 n elif n <= heap[1]:
                heap.append(n)
             n <= heap[1] n heap[1] heap 1 heap.append(n) heap.append heap append n heap.insert(1, n) heap.insert heap insert 1 n elif n > heap[2]:
            if n >= heap[0]:
                heap.insert(0, n)
            elif n >= heap[1]:
                heap.insert(1, n)
            else:
                heap.insert(2, n)
            heap.pop()
     n > heap[2] n heap[2] heap 2 if n >= heap[0]:
                heap.insert(0, n)
            elif n >= heap[1]:
                heap.insert(1, n)
            else:
                heap.insert(2, n)
             n >= heap[0] n heap[0] heap 0 heap.insert(0, n) heap.insert heap insert 0 n elif n >= heap[1]:
                heap.insert(1, n)
             n >= heap[1] n heap[1] heap 1 heap.insert(1, n) heap.insert heap insert 1 n heap.insert(2, n) heap.insert heap insert 2 n heap.pop() heap.pop heap pop for num in heap:
    print num num heap print heap = [] [] heap n = int(raw_input()) int(raw_input()) n
heap = []
while True:
    try:
        n = int(raw_input())
        if len(heap) == 0:
            heap.append(n)
        elif len(heap) == 1:
            if n <= heap[0]:
                heap.append(n)
            else:
                heap.insert(0, n)
        elif len(heap) == 2:
            if n > heap[0]:
                heap.insert(0, n)
            elif n <= heap[1]:
                heap.append(n)
            else:
                heap.insert(1, n)
        elif n > heap[2]:
            if n >= heap[0]:
                heap.insert(0, n)
            elif n >= heap[1]:
                heap.insert(1, n)
            else:
                heap.insert(2, n)
            heap.pop()
    except (EOFError):
        break
for num in heap:
    print num