Schoolboy Vasya is
toying with numbers. He chooses n distinct positive integers a1,
a2, 
, an in ascending order
and calculates the greatest common denominators (GCD) for all pairs <ai, aj>
with i < j, writing
down the results in a table. For example, numbers 1, 2, 3, 4, 5, 6, 7, 8 will
produce the following GCD table:
                           
1: 1, 1, 1, 1, 1, 1, 1
                           
2: 1, 2, 1, 2, 1, 2
                           
3: 1, 1, 3, 1, 1
                           
4: 1, 2, 1, 4
                           
5, 1, 1, 1
                           
6: 1, 2
                           
7: 1
                           
8: 
Obviously, several sequences can produce the
same GCD table, thus in general it is impossible to restore the exact original
sequence using only the GCD table. Write a program that, given the GCD table,
will restore a possible initial sequence a1, a2, 
, an. If several such sequences
exist then any of them will be considered as a correct answer.
 
Limitations
1 <= n <= 100; 1 <= ai <= 109; 1 <= GCD(ai , aj) <= 104.
 
Input
The first line contains an integer n, the number of integers in the sequence. The following n1 lines describe the rows of the GCD table for
a1, a2, 
,
an1, respectively. The line for ai contains ni
integers separated by spaces: GCD(ai, ai+1), 
GCD(ai, ai+2), 
,
GCD(ai, an). You can safely assume that the input
data is based on some real sequence a1, a2,
a3, 
, an,
which means that a solution always exists.
 
Output
The output file should contain n space-delimited integers: possible initial
numbers a1, a2, 
, an, respectively.
 
Example
 
  
  Input
   | 
  
  Output
   | 
 
 
  | 
   4 
  4 4 2 
  4 2 
  6 
   | 
  
   4 8 12 18 
   | 
 
 
 
  
  Input
   | 
  
  Output
   | 
 
 
  | 
   4 
  2 2 2 
  2 2 
  2 
   | 
  
   2 6 8 10 
   | 
 
 
 
All Rybinsk-2012 problems (in PDF)