#include<iostream>
using namespace std;
const int N = 2E5 + 10;
long long k[N],b[N];
long long gcd(long long x,long long y)
{
return x%y == 0?y:gcd(y,x%y);
}
long long lcm(long long x,long long y)
{
return x*y/gcd(x,y);
}
void solve()
{
int n;cin >> n;
long long ans = 1;
for(int i = 1;i <= n;i ++)
{
cin >> k[i];
ans = lcm(ans,k[i]);
}
long long s = 0;
for(int i = 1;i <= n;i ++)
{
b[i] = ans / k[i];
s += b[i];
}
if(s >= ans)cout << "-1" << endl;
else{
for(int i = 1;i <= n;i ++)
cout << b[i] << ' ';
cout << endl;
}
}
int main()
{
int t;cin >> t;
while(t --)
solve();
return 0;
}