n = int(raw_input())
gcd = [int(x) for x in raw_input().split()]
gcd_sorted = sorted(gcd, reverse=True)
gcd_sorted.append(-1)
#print gcd_sorted










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()


	
