The GCD table G of size n × n for an array of positive integers a of length n is defined by formula 

<image>

Let us remind you that the greatest common divisor (GCD) of two positive integers x and y is the greatest integer that is divisor of both x and y, it is denoted as <image>. For example, for array a = {4, 3, 6, 2} of length 4 the GCD table will look as follows:

<image>

Given all the numbers of the GCD table G, restore array a.

Input

The first line contains number n (1 ≤ n ≤ 500) — the length of array a. The second line contains n2 space-separated numbers — the elements of the GCD table of G for array a. 

All the numbers in the table are positive integers, not exceeding 109. Note that the elements are given in an arbitrary order. It is guaranteed that the set of the input data corresponds to some array a.

Output

In the single line print n positive integers — the elements of array a. If there are multiple possible solutions, you are allowed to print any of them.

Examples

Input

4
2 1 2 3 4 3 2 6 1 1 2 2 1 2 3 2


Output

4 3 6 2

Input

1
42


Output

42 

Input

2
1 1 1 1


Output

1 1 

import java.io.*;
import java.util.*;

public class Q {

  public static void main(String[] args) throws IOException {
    Reader reader = new Reader();
    reader.initConsoleReading();
    OutputStream outputStream = System.out;
    PrintWriter out = new PrintWriter(outputStream);
    int n = reader.nextInt();
    int[] nums = new int[(n * n) + 1];
    Map<Integer, Integer> map = new HashMap<>();
    for (int i = n * n; i >= 1; i--) {
      nums[i] = reader.nextInt();
      map.put(nums[i], map.getOrDefault(nums[i], 0) + 1);
    }
    Arrays.sort(nums, 1, (n * n) + 1);
//    System.out.println(Arrays.toString(nums));
    List<Integer> ans = new ArrayList<>();
    for (int i = n * n; i >= 1; i--) {
      int count = map.getOrDefault(nums[i], 0);
      if (count > 0) {
        for (int a : ans) {
          int g = (int) gcd(a, nums[i]);
          //          if(map.get(g)==0) // throw exception
          map.put(g, map.get(g) - 2);
        }
        map.put(nums[i], map.get(nums[i]) - 1);
        ans.add(nums[i]);
      }

      if (ans.size() == n) break;
    }
    for (int a : ans) {
      out.printf("%d ", a);
    }
    out.println("");
    out.close();
    reader.dispose();
  }

  /**
   * **********************************Helper Methods Begin
   * Here*********************************************
   */
  private static String reverse(String toRev) {
    return new StringBuilder(toRev).reverse().toString();
  }

  public static class Pair<F extends Comparable<F>, S extends Comparable<S>>
      implements Comparable<Pair<F, S>> {
    static final int prime = 31;
    private F first;
    private S second;

    public Pair(F f, S s) {
      this.first = f;
      this.second = s;
    }

    @Override
    public int hashCode() {
      int result = 1;
      result = prime * result + this.first.hashCode();
      result = prime * result + this.second.hashCode();
      return result;
    }

    @Override
    public boolean equals(Object obj) {
      if (this == obj) return true;
      if (obj == null) return false;
      if (getClass() != obj.getClass()) return false;
      Pair<F, S> s = (Pair<F, S>) obj;
      return this.first.equals(s.first) && this.second.equals(s.second);
    }

    @Override
    public int compareTo(Pair<F, S> p) {
      int c1 = this.first.compareTo(p.first);
      if (c1 == 0) {
        return this.second.compareTo(p.second);
      }
      return c1;
    }
  }

  public static int swap(int a, int b) {
    /*a = Main.swap(b,b=a); goes from left to right*/
    return a;
  }

  public static long swap(long a, long b) {
    /*a = Main.swap(b,b=a); goes from left to right*/
    return a;
  }

  public static boolean next_permutation(int[] p) {
    for (int a = p.length - 2; a >= 0; --a)
      if (p[a] < p[a + 1])
        for (int b = p.length - 1; ; --b)
          if (p[b] > p[a]) {
            int t = p[a];
            p[a] = p[b];
            p[b] = t;
            for (++a, b = p.length - 1; a < b; ++a, --b) {
              t = p[a];
              p[a] = p[b];
              p[b] = t;
            }
            return true;
          }
    return false;
  }

  public static long gcd(long a, long b) {
    if (a < 0) a *= -1;
    if (b < 0) b *= -1;
    return b == 0 ? a : gcd(b, a % b);
  }

  public static class Reader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public Reader() {}

    public Reader initConsoleReading() {
      reader = new BufferedReader(new InputStreamReader(System.in), 32768);
      tokenizer = null;
      return this;
    }

    public Reader initFileReading(String filePath) throws FileNotFoundException {
      reader = new BufferedReader(new FileReader(filePath), 32768);
      tokenizer = null;
      return this;
    }

    public String next() {
      while (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    }

    public String nextLine() throws IOException {
      return reader.readLine();
    }

    public int nextInt() {
      return Integer.parseInt(next());
    }

    public long nextLong() {
      return Long.parseLong(next());
    }

    public void dispose() throws IOException {
      this.reader.close();
    }
  }
  /**
   * **********************************Helper Methods Ends
   * Here*********************************************
   */
}
