#include <fstream>
void bezout_gcd(int a, int &x, int b, int &y, int &d)
{
int r_x, r_y;
if (b == 0) {
x = 1;
y = 0;
d = a;
} else {
bezout_gcd(b, r_x, a % b, r_y, d);
x = r_y;
y = r_x - (a / b) * r_y;
}
}
int main()
{
int n;
std::ifstream fin("euclid3.in");
std::ofstream fout("euclid3.out");
fin >> n;
for (int a, x, b, y, d, c, i = 0; i < n; ++i) {
fin >> a >> b >> c;
bezout_gcd(a, x, b, y, d);
if (c > d)
if (c % d)
fout << "0 0\n";
else
fout << x * (c / d) << ' ' << y * (c / d) << '\n';
else
if (d % c)
fout << "0 0\n";
else
fout << x * (d / c) << ' ' << y * (d / c) << '\n';
}
fin.close();
fout.close();
return 0;
}