/******************************************************************************
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, OCaml, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.
*******************************************************************************/
#include <fstream>
using namespace std;
ifstream fin("euclid3.in");
ofstream fout("euclid3.out");
long long int t, i, a, b, c, d, x, y;
void euclid(long long int a, long long int b, long long int d, long long int x, long long int y)
{
if(b==0)
{
d=a;
x=1;
y=1;
}
else
{
long long int x0, y0;
euclid(b,a%b,d,x0,y0);
x=y0;
y=x0-(a/b)*y0;
}
}
int main()
{
fin>>n;
for (inti=0;i<=n;i++)
{
int a,b,c,d,x,y;
fin >>a>>b>>c;
euclid(a,b,d,x,y);
if(c%d!=0)
{
fout<<"0 0"<<'\n';
}
}
return 0;
}