#include <bits/stdc++.h>
using namespace std;
ifstream fin( "euclid3.in" );
ofstream fout( "euclid3.out" );
void euclid( long long a, long long b, long long& x, long long& y, long long& d ) {
if ( b == 0 ) {
x = 1;
y = 0;
d = a;
} else {
euclid( b, a % b, x, y, d );
long long x2 = y;
long long y2 = x - (long long)(a / b) * y;
x = x2;
y = y2;
}
}
void solve() {
long long a, b, c, x, y, d;
fin >> a >> b >> c;
euclid( a, b, x, y, d );
if ( c % d != 0 ) {
fout << "0 0\n";
} else {
fout << x * c / d << ' ' << y * c / d << '\n';
}
}
int main() {
int t;
fin >> t;
while ( t-- ) solve();
return 0;
}