#include <bits/stdc++.h>
//#include <bits/extc++.h>
using namespace std;
#define USE_STD_IO 0
#if USE_STD_IO
#define fin cin
#define fout cout
#else
ifstream fin("euclid3.in");
ofstream fout("euclid3.out");
#endif // USE_STD_IO
static inline int Euclid(int a, int b, int& x, int& y) {
if(0 == b) {
x = 1;
y = 0;
return a;
}
else {
int x0, y0;
int d = Euclid(b, a % b, x0, y0);
x = y0;
y = x0 - (a / b) * y0;
return d;
}
}
int main() {
#if USE_STD_IO
ios_base::sync_with_stdio(false);
#endif // USE_STD_IO
fin.tie(NULL);
fout.tie(NULL);
int t;
fin >> t;
while(0 < t--) {
int a, b, c, x, y;
fin >> a >> b >> c;
int d = Euclid(a, b, x, y);
if(0 != c % d) fout << "0 0\n";
else fout << x << ' ' << y << '\n';
}
return 0;
}