#include <iostream>
#include <fstream>
using namespace std;
ifstream f ( "euclid3.in" );
ofstream g ( "euclid3.out" );
int euclid ( int a, int b, int &x, int &y )
{
if ( b == 0 )
{
x = 1;
y = 0;
return a;
}
int x0, y0, d;
d = euclid ( b, a % b, x0, y0 );
int c = a / b;
x = y0;
y = x0 - c * y0;
return d;
}
int main()
{
int T;
f >> T;
while ( T-- )
{
int a, b, x, y, c;
f >> a >> b >> c;
int d = euclid ( a, b, x, y );
// cout<<x<<' '<<y<<'\n';
if ( c % d != 0 )
g << 0 << ' ' << 0 << '\n';
else g << x*(c / d) << ' ' << y*(c / d) << '\n';
}
return 0;
}