#include <iostream>
#include <fstream>
#define ll long long
using namespace std;
ifstream fin("euclid3.in");
ofstream fout("euclid3.out");
void euclid(ll a, ll b, ll *d, ll *x, ll *y)
{
if (b == 0) {
*d = a;
*x = 1;
*y = 0;
} else {
ll x0, y0;
euclid(b, a % b, d, &x0, &y0);
*x = y0;
*y = x0 - (a / b) * y0;
}
}
int main() {
ll n;
fin >> n;
ll a, b, c;
ll d, x, y; d = x = y = 0;
while (n--) {
fin >> a >> b >> c;
euclid(a, b, &d, &x, &y);
if (c % d) {
fout << 0 << ' ' << 0 << '\n';
continue;
}
fout << x * c / d << ' ' << y * c / d << '\n';
}
}