d = []
b = 1
N = int(input())
A = [input() for i in range(N)]
A = [int(x) for x in A]
for m in range(N):
    e = A[m]
    A.pop(m)

    for n in range(N-1):
        if m == n:
            continue
        c = A[n] // b
        if c >= 1:
            b = A[n]
        else:
            b = b

    d.append(b)
    A.insert(m , e)
for o in range(N):
    print(d[o])
