Problem:
Problem H: Squid Multiplication

Squid Eiko loves mathematics.
Especially she loves to think about integer.
One day, Eiko found a math problem from a website.

"A sequence b ={ai + aj | i < j } is generated from a sequence a ={a0 , ... , an | ai is even if i is 0, otherwise ai is odd}. Given the sequence b , find the sequence a ."

This problem is easy for Eiko and she feels boring. So, she made a new problem by modifying this problem .

"A sequence b ={ai *aj | i < j } is generated from a sequence a ={ a0, ... , an | ai is even if i is 0, otherwise ai is odd}. Given the sequence b , find the sequence a ."

Your task is to solve the problem made by Eiko.

Input

Input consists of multiple datasets.

Each dataset is given by following formats.

n
b0 b1 ... bn*(n+1)/2-1

n is the number of odd integers in the sequence a. The range of n is 2 ≤ n ≤ 250.
bi is separated by a space.
Each bi is 1 ≤ bi ≤ 263-1.
The end of the input consists of a single 0.

Output

For each dataset, you should output two lines.
First line contains a0, an even number in the sequence a.
The second line contains n odd elements separated by a space. The odd elements are sorted by increasing order.
You can assume that the result is greater than or equal to 1 and less than or equal to 231-1.

Sample input

3
6 10 14 15 21 35
2
30 42 35
0

Sample output

2
3 5 7
6
5 7

Solution in C++ (judge verdict: Accepted)

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long LL;
const int MAXN = 125555;
LL a[MAXN], b[MAXN], c[MAXN], d[MAXN];
bool vis[MAXN];
const double eps = 1e-2;
inline int sgn(double x) {
	return x < -eps ? -1 : x > eps;
}

int main() {
	int n;
	while (scanf("%d", &n) != EOF && n) {
		int m = n * (n + 1) / 2;
		int cn = 0, dn = 0;
		for (int i = 0; i < m; i++) {
			scanf("%lld", &b[i]);
			if (!(b[i] & 1)) {
				c[cn++] = b[i];
			} else {
				d[dn++] = b[i];
			}
		}
		sort(c, c + cn);
		sort(d, d + dn);
		a[0] = (long long)(sqrt((double(c[0]) * c[1] / d[0])) + 0.5);
		/*for (LL x = max(0LL, a[0] - 500); ; x++) {
			if (sgn(double(x) * x * d[0] - ((double)c[0] * c[1])) == 0) {
				a[0] = x;
				break;
			}
		}*/
		printf("%lld\n", a[0]);
		for (int i = 0; i < cn; i++) {
			if (i) putchar(' ');
			printf("%lld", c[i] / a[0]);
		}
		puts("");
	}
}