import java.io.BufferedReader;
import java.io.InputStreamReader;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Comparator;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class GcdTable {

	private static final String SPACE = " ";

	public static void main(String[] args) throws Exception {
		GcdTable instance = new GcdTable();
		instance.begin();
	}

	public void begin() throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		List<Integer> resultTable = new ArrayList<Integer>(n);
		Map<Integer, Integer> numToSkip = new HashMap<Integer, Integer>(n);
		List<Integer> gcdTable = Stream.of(br.readLine().split(SPACE)).mapToInt(Integer::parseInt).boxed().sorted(Comparator.reverseOrder()).collect(Collectors.toList());
		int lastChoseGcd = 0;
		int index = 0;
		while(resultTable.size() < n) {
			while(numToSkip.containsKey(gcdTable.get(index)) && numToSkip.get(gcdTable.get(index)) > 0) {
				numToSkip.put(gcdTable.get(index), numToSkip.get(gcdTable.get(index)) - 1);
				index++;
			}
			lastChoseGcd = gcdTable.get(index++);
			for(int i = 0;i < resultTable.size();i++) {
				int gcd = calculeGcd(lastChoseGcd, resultTable.get(i));
				int currentSkip = numToSkip.containsKey(gcd) ? numToSkip.get(gcd) : 0;
				numToSkip.put(gcd, currentSkip + 2);
			}
			resultTable.add(lastChoseGcd);
		}
		resultTable.stream().forEach(System.out::println);
	}

	private int calculeGcd(int fNum, int sNum) {
		if(sNum == 0) {
			return fNum;
		} else {
			return calculeGcd(sNum, fNum % sNum);
		}
	}

}
