#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
#define int long long
void solve()
{
int a,b,c;
cin >> a >> b >>c;
if(c == 0) {
cout << a << " " << b << " " << 1 << " " << 0 << "\n";
return;
}
int aa = abs(a);
int bb = abs(b);
int cc = abs(c);
vector<int> pa;
// if (a == 0) {
// pa.push_bacK(0);
// }
for (int i=1;i*i<=aa;i++) {
if (aa % i == 0) {
pa.push_back(i);
if (i * i != aa) {
pa.push_back(aa/i);
}
if (a < 0) {
pa.push_back(-i);
if (i * i != aa) {
pa.push_back(-aa/i);
}
}
}
}
vector<int> pc;
// if (c == 0) {
// pc.push_bacK(0);
// }
for (int i=1;i*i<=cc;i++) {
if (cc % i == 0) {
pc.push_back(i);
if (i * i != cc) {
pa.push_back(cc/i);
}
if (c < 0) {
pc.push_back(-i);
if (i * i != cc) {
pa.push_back(-cc/i);
}
}
}
}
for (const auto &x : pa) {
for (const auto &y : pc) {
if (y * y * a + x * x * c == x * y * b) {
cout << a / x << " " << c / y << " " << x << " " << y << "\n";
return ;
}
}
}
cout << "NO\n";
}
signed main() {
int _t;
cin>>_t;
while(_t--) {
solve();
}
}