PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#GL0000111. Khôi phục bảng ƯCLN (GCD Table)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Khôi phục bảng ƯCLN (GCD Table)

GCD Table

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

An array aa of nn positive integers generates an n×nn\times n table with entry (i,j)=gcd⁡(ai,aj)(i,j)=\gcd(a_i,a_j). You are given all n2n^2 table entries in arbitrary order. Reconstruct any array whose GCD table has exactly that multiset of values. A valid array is guaranteed to exist.

Input

The first line contains nn. The next line contains exactly n2n^2 positive table entries.

Output

Print nn positive integers of a valid reconstructed array.

Subtasks

  • Subtask 1 (20 points): 1≤n≤81\le n\le8, 1≤Gi,j≤1001\le G_{i,j}\le100.
  • Subtask 2 (30 points): 1≤n≤601\le n\le60, 1≤Gi,j≤1061\le G_{i,j}\le10^6.
  • Subtask 3 (50 points): 1≤n≤5001\le n\le500, 1≤Gi,j≤1091\le G_{i,j}\le10^9.

Examples

Input

2
1 1 1 1

Output

1 1

Explanation

The array (1,1)(1,1) generates a 2×22\times2 table with all four entries equal to 11.