// Algoritmul lui Euclid extins.cpp : Defines the entry point for the console application.
//
#include <iostream>
#include <fstream>
#include <math.h>
using namespace std;
ifstream fin("euclid3in.txt");//replace
ofstream fout("euclid3out.txt");
long long cmmdc(long long a, long long b)
{
long long t;
while (b)
{
t = a%b;
a = b;
b = t;
}
return a;
}
int main()
{
cout << sizeof(int);
size_t n;
long long a, b, c, d;
double x, y1,y2;
fin >> n;
for (size_t i = 1; i <= n; i++)
{
fin >> a >> b >> c;
d = cmmdc(a, b);
if (floor((double)c / d) == (double)c / d)
{
x = 0;
y1 = (double)-a / b*x + (double)c / b;
y2 = (double)a / b*x + (double)c / b;
while ((y1 - floor(y1) > 0.0005) && (y2 - floor(y2) > 0.0005))
{
x = x + 1;
y1 = (double)-a / b*x + (double)c / b;
y2 = (double)a / b*x + (double)c / b;
if ((abs(x) > 2000000000) || (abs(y1) > 2000000000) || (abs(y2) > 2000000000))
{
break;
}
}
if (y1 - floor(y1) < 0.0005)
{
fout << x << " " << y1 << "\n";
}
else if (y2 - floor(y2) < 0.0005)
{
fout << -x << " " << y2 << "\n";
}
}
else
{
fout << 0 << " " << 0 << "\n";
}
}
return 0;
}