def countingSort(A,B):

    k = max(A)

    C = [0]*(k+1)

    

    for j in range(len(A)):

        C[A[j]] += 1

    

    for i in range(1,k+1):

        C[i] += C[i-1]   

    for j in range(len(A)):

        B[C[A[j]]-1] = A[j]

        C[A[j]] -=1



n = int(eval(input()))

A = list(map(int,input().split()))

B = [0]* len(A)

countingSort(A,B)

print((*B))
def countingSort(a,n):

    count = [0]*(max(a)+1)

    for k in a:

      count[k] += 1

    for i in range(len(count)-1):

      count[i+1] += count[i]

    

    sorted_a = [0]*n



    for k in a[::-1]:

        sorted_a[count[k]-1] = k

        count[k] -= 1

    return sorted_a



n = int(eval(input()))

a = list(map(int,input().split()))

print((*countingSort(a,n)))
def countingSort(A, B):
    k = max(A)
    C = [0] * (k + 1)
    for j in range(len(A)):
        C[A[j]] += 1
    for i in range(1, k + 1):
        C[i] += C[i - 1]
    for j in range(len(A)):
        B[C[A[j]] - 1] = A[j]
        C[A[j]] -= 1


n = int(eval(input()))
A = list(map(int, input().split()))
B = [0] * len(A)
countingSort(A, B)
print((*B))

def countingSort(a, n):
    count = [0] * (max(a) + 1)
    for k in a:
        count[k] += 1
    for i in range(len(count) - 1):
        count[i + 1] += count[i]
    sorted_a = [0] * n
    for k in a[::-1]:
        sorted_a[count[k] - 1] = k
        count[k] -= 1
    return sorted_a


n = int(eval(input()))
a = list(map(int, input().split()))
print((*countingSort(a, n)))

-def countingSort(A, B): -    k = max(A) -    C = [0] * (k + 1) -    for j in range(len(A)): -        C[A[j]] += 1 -    for i in range(1, k + 1): -        C[i] += C[i - 1] -    for j in range(len(A)): -        B[C[A[j]] - 1] = A[j] -        C[A[j]] -= 1 +def countingSort(a, n): +    count = [0] * (max(a) + 1) +    for k in a: +        count[k] += 1 +    for i in range(len(count) - 1): +        count[i + 1] += count[i] +    sorted_a = [0] * n +    for k in a[::-1]: +        sorted_a[count[k] - 1] = k +        count[k] -= 1 +    return sorted_a -A = list(map(int, input().split())) -B = [0] * len(A) -countingSort(A, B) -print((*B)) +a = list(map(int, input().split())) +print((*countingSort(a, n)))