#include <iostream>
#include <fstream>
using namespace std;
ifstream f("euclid3.in");
ofstream g("euclid3.out");
void euclid_extins (int &x, int &y, int a, int b, int &d){
if(!b)
{
d = a;
x = 1, y = 0;
}
else
{
int x1 , y1;
euclid_extins(x1, y1, b , a%b , d);
x=y1;
y=x1-a/b*y1;
}
}
int main(){
int n = 0, a=0, b=0, c=0, x=0,y=0, d=0;
f>>n;
for(int i=0;i<n;++i){
f>>a>>b>>c;
euclid_extins(x,y,a,b,d);
if(c%d==0){
g<<x*(c/d)<<" "<<y*(c/d)<<'\n';
}
else{
g<<"0 0\n";
}
}
f.close();
g.close();
return 0;
}