#include <cstdio>
using namespace std;
FILE *f1,*f2;
long t,a,b,d,x,y,c,i;
void euclid(long a,long b,long &d,long &x,long &y)
{if (b==0)
{d=a;
x=1;
y=0;
}
else
{long x0,y0;
euclid(b,a%b,d,x0,y0);
x=y0;
y=x0-(a/b)*y0;
}
}
int main()
{f1 = fopen("euclid3.in","r");
f2 = fopen("euclid3.out","w");
fscanf(f1,"%ld",&t);
for(i=1;i<=t;i++)
{fscanf(f1,"%ld%ld%ld",&a,&b,&c);
euclid(a,b,d,x,y);
if (c%d!=0) fprintf(f2,"0 0\n");
else fprintf(f2,"%ld %ld\n",x*(c/d),y*(c/d));
}
fclose(f1);fclose(f2);
return 0;
}
//Challenges are what make life interesting and overcoming them is what makes life meaningful.