#include <stdio.h>
#include <stdlib.h>
void euclidE( int a, int b, int *d, int *x, int *y ) {
int x0, y0;
if ( b == 0 ) {
*d = a;
*x = 1;
*y = 0;
} else {
euclidE( b, a % b, d, &x0, &y0 );
*x = y0;
*y = x0 - ( a / b ) * y0;
}
}
int main() {
FILE *fin, *fout;
int t, a, b, c, d, x, y, i;
fin = fopen( "euclid3.in", "r" );
fout = fopen( "euclid3.out", "w" );
fscanf( fin, "%d", &t );
for ( i = 0; i < t; i++ ) {
fscanf( fin, "%d%d%d", &a, &b, &c );
euclidE( a, b, &d, &x, &y );
if ( c % d == 0 ) {
fprintf( fout, "%d %d\n", x * ( c / d ) , y * ( c / d ) );
} else {
fprintf( fout, "0 0\n" );
}
}
fclose( fin );
fclose( fout );
return 0;
}