/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("euclid3.in");
ofstream fout("euclid3.out");
int euclid_extins(int &x, int &y, int a, int b)
{
if(!b)
{
x = 1;
y = 0;
return a;
}
else
{
int d, x1, y1;
d = euclid_extins (x1, y1, b, a % b);
x = y1;
y = x1 - y1 * (a / b);
return d;
}
}
int main() {
int n,a,b,c,d,x,y;
fin>>n;
while(n){
fin>>a>>b>>c;
d = euclid_extins(x,y,a,b);
if (c % d)
fout<<"0 0\n";
else
fout<<x * (c / d)<<" "<<y * (c / d)<<"\n";
n--;
}
return 0;
}