n = int(input())
a = list(map(int, input().split()))
idx = list(range(n))
d = list(a) 
lim = int(max(a)**0.5)+1

for i in range(2, lim):
  idxbef = list(idx)
  for j in idxbef:
    if a[j]%i == 0:
      d[j]=i
      idx.remove(j)
print(d)
  