#include <iostream>
#include <fstream>
#define NMAX 1002
#include <bits/stdc++.h>
using namespace std;
ifstream fin ("euclid3.in");
ofstream fout ("euclid3.out");
int x,y;
void euclid(int a, int b, int & d, int &x, int &y)
{
if(b==0)
{
d=a;
x=1;
y=0;
}
else
{
int x1, y1;
euclid(b,a%b,d,x1,y1);
x=y1;
y=x1-(a/b)*y1;
}
}
int cmmdc(int a, int b)
{
if(b>a)
swap(a,b);
int r;
while(b)
{
r=a%b;
a=b;
b=r;
}
return a;
}
int main()
{
ios_base::sync_with_stdio(0);
int n,m,i,j,t,q,nr,minim,maxim,suma,tmax,st,dr,mij,a,b,c,d,e;
fin>>t;
while(t--)
{
fin>>a>>b>>c;
d=cmmdc(a,b);
if(c%d)
fout<<"0 0\n";
else
{
euclid(a,b,d,x,y);
fout<<x*(c/d)<<' '<<y*(c/d)<<'\n';
}
}
return 0;
}