• 应用
• 登录
• 注册

# CF582A GCD Table

• 1通过
• 1提交
• 题目来源
• 评测方式 RemoteJudge
• 标签
• 难度 尚无评定
• 时空限制 2000ms / 256MB
• 提示：收藏到任务计划后，可在首页查看。

## 推荐的相关题目 显示

本题征求翻译。如果你能提供翻译或者题意简述，请直接发讨论，感谢你的贡献。

## 题目描述

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

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 . For example, for array $a={4,3,6,2}$ of length 4 the GCD table will look as follows:

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

## 输入输出格式

输入格式：

The first line contains number $n$ ( $1<=n<=500$ ) — the length of array $a$ . The second line contains $n^{2}$ 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 $10^{9}$ . 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$ .

输出格式：

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.

## 输入输出样例

输入样例#1： 复制
4
2 1 2 3 4 3 2 6 1 1 2 2 1 2 3 2

输出样例#1： 复制
4 3 6 2
输入样例#2： 复制
1
42

输出样例#2： 复制
42
输入样例#3： 复制
2
1 1 1 1

输出样例#3： 复制
1 1
提示
标程仅供做题后或实在无思路时参考。
请自觉、自律地使用该功能并请对自己的学习负责。
如果发现恶意抄袭标程，将按照I类违反进行处理。