#include <fstream>
#include <algorithm>
using namespace std;
int gcd(int a , int b){
if(b == 0) return a;
return gcd(b , a%b);
}
int exGcd(int a, int b , int &c , int &d){
if(b == 0){
c = 1;
d = 0;
return a;
}
int x1 , y1;
int y = exGcd(b , a%b , x1 , y1);
c = y1;
d = x1 - (a/b)*y1;
return y;
}
int main(){
ifstream fin("euclid3.in");
ofstream fout("euclid3.out");
int n , a , b ,c;
fin>> n;
for(int i=0;i<n;i++){
fin>>a>>b>>c;
int d = gcd(a , b);
if(c % d != 0){
fout<<0<<" "<<0<<'\n';
continue;
}
int mul = c/d;
int x , y;
exGcd(a , b , x , y);
fout<<mul*x<<" "<<mul*y<<'\n';
}
}