import math
n = int(raw_input())
gcd = [int(x) for x in raw_input().split()]
gcd_sorted = sorted(gcd, reverse=True)
#gcd_sorted.append(-1)
gcds = gcd_sorted
distinct = [0 for i in range(n*n)]
dis = 0
distinct[0] = gcds[0]
for i in range(1, n*n):
	if gcds[i] != gcds[i-1]:
		dis+=1
		distinct[dis] = gcds[i]
distinct = distinct[:dis+1]
#print distinct
nn = 0
dd = {}
for x in gcds:
	if x not in dd:
		dd[x] = 1
	else:
		dd[x]+=1
#print gcd_sorted

def add_element(a):
	#for i in range(n*n):
		#if gcds[i] != 0:
			#print 'i ', i
			#break
	#print 'count ', gcds.count(gcds[i]), gcds[i]
	
	#current = gcds[i]
	try:
		global nn
		cnt = 0
		while cnt == 0:
			current = distinct[nn]
			nn+=1
			cnt = dd[current]
		#cnt = gcds.count(gcds[i])
		cnt = dd[current]
		if cnt == 0:
			print 'panic'
			exit()
		cnt2 = cnt
		c = 0
	except:
		exit()
	if len(a) > 0:
		try:
			b3 = 0
			decr = 0
			for i in range(len(a)):
				prev = a[i][0]
				#print 'prev, i, ', prev, i
				prev_len = len(a[i])
				#bb = bmm(prev, current)
				if prev % current == 0:
					b3+=1
					decr += prev_len*2
			cnt2 = cnt
		except:
			exit()
		try:
			if b3 > 0:
				c = 0
				while (c*c != cnt2):
					cnt2 -= decr
					c+=1
		except:
			exit()
			#print 'c', c
				#if cnt2 < 0:
					#print 'no answer'
					#exit()
	try:
		if cnt2 < 0:
			print 'panic'
			exit()
		if c > 0:
			sq = c
		else:
			sq = int(math.sqrt(cnt2)+0.001)
		#print 'sq ', sq
		a.append([current for j in range(sq)])
		#print 'a ', a
		#print 'gcds ', gcds
		#for i in range(len(gcds)):
			#if gcds[i] == a[-1][0]:
				#gcds[i] = 0
		dd[current] = 0
		#print a
	except:
		exit()

def bmm(x, y):
	try:
		if x < y:
			x = x^y
			y = x^y
			x = x^y
		if y == 0:
			print 'panic'
			exit()
		l = x%y
		if  l == 0:
			return y
		return bmm(y, l)
	except:
		exit()
			
def correct():
	try:
		if len(a) < 2:
			return
		x = a[-1]
		for i in range(len(a)-1):
			y = a[i]
			b = bmm(y[0], x[0])
			if b == x[0]:
				continue
			#print b
			if b not in dd:
				print 'panic'
				exit()
			dd[b] -= 2*len(x)*len(y)
	except:
		exit()
		#dd[b]-=k
	#l = gcds.index(b)
	#for i in range(l, len(gcds)):
		#if k == 0:
			#break
		#if gcds[i] == b:
			#gcds[i] = 0
			#k-=1

	#for i in range(2*len(x)):
		#for j in range(len(y)):
			#l = gcds.index(b)
			#gcds[l] = 0


#ans = [0 for i in range(n+1)]
#ans[0] = gcds[0]
#i = 0
#while (gcds[i]!=gcds[0]):
#	i+=1
#if i == n:
#	for i in range(n):
#		print ans[0],
#	exit()
#ans[1] = gcds[i]
#k = 0; l = 1 

a = []
i = n
kjk = 70
while i > 0:
	add_element(a)
	i-=len(a[-1])
	if  a[-1][0] == 0:
		print 'panic'
		exit()
	correct()
try:
	for x in a:
		for y in x:
			print y,
except:
	exit()
exit()



def second_attempt():
	k = 1;
	for i in range(1, n*n+1):
		#print i, k
		if gcd_sorted[i] != gcd_sorted[i-1]:
			if (k%2 == 1):
				print gcd_sorted[i-1],
			#elif k%4 == 0:
			#	print gcd_sorted[i-1], gcd_sorted[i-1],
			k = 1
		else:
			k+=1

#nums = [0 for i in range[k]]
def first_attempt():
	for i in range(n):
		print gcd_sorted[i],
	
	


#second_attempt()


	
