// Problema rucsacului.cpp : Defines the entry point for the console application.
#include "stdafx.h"
#include <iostream>
#include <fstream>
using namespace std;
int t, a, b, c;
int gcd(int a, int b, int &x, int &y)
{
if (b == 0)
{
x = 1;
y = 0;
return a;
}
int x0, y0, d;
d = gcd(b, a%b, x0, y0);
x = y0;
y = x0 - (a / b)*y0;
cout << x << " " << y << " " << x0 << " " << y0 << " " << d<<"\n";
return d;
}
int main()
{
ifstream fin("euclid3.in");
ofstream fout("euclid3.out");
fin >> t;
for (int i = 0; i < t; i++)
{
fin >> a >> b >> c;
int d, x, y;
d = gcd(a, b, x, y);
if (c % d)
fout << 0 << " " << 0<<"\n";
else
fout << x*(c / d) << " " << y*(c / d)<<"\n";
}
system("PAUSE");
return 0;
}