{"raw_statement":[{"iden":"problem statement","content":"There are $N$ integers written on a blackboard. The $i$\\-th integer is $A_i$.\nTakahashi and Aoki will arrange these integers in a row, as follows:\n\n*   First, Takahashi will arrange the integers as he wishes.\n*   Then, Aoki will repeatedly swap two adjacent integers that are coprime, as many times as he wishes.\n\nWe will assume that Takahashi acts optimally so that the eventual sequence will be lexicographically as small as possible, and we will also assume that Aoki acts optimally so that the eventual sequence will be lexicographically as large as possible. Find the eventual sequence that will be produced."},{"iden":"constraints","content":"*   $1 ≦ N ≦ 2000$\n*   $1 ≦ A_i ≦ 10^8$"},{"iden":"input","content":"The input is given from Standard Input in the following format:\n\n$N$\n$A_1$ $A_2$ … $A_N$"},{"iden":"sample input 1","content":"5\n1 2 3 4 5"},{"iden":"sample output 1","content":"5 3 2 4 1\n\nIf Takahashi arranges the given integers in the order $(1,2,3,4,5)$, they will become $(5,3,2,4,1)$ after Aoki optimally manipulates them."},{"iden":"sample input 2","content":"4\n2 3 4 6"},{"iden":"sample output 2","content":"2 4 6 3"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}