For a sequence A=(a1,a2,…,aN) of length N, the GCD table G is defined by
gij=gcd(ai,aj)
where gcd(x,y) is the greatest common divisor of x and y. For example, the GCD table of A=(4,3,6,2) is
All N2 values of the GCD table G are given in arbitrary order. Restore the original sequence A.