孩子真的不知道错哪里了
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lll __int128
#define ull unsigned ll
#define ld long double
#define db double
template<typename T>inline void read(T& x) {
x=0;int f=1;
char ch=getchar();
while(!isdigit(ch)){if(ch=='-')f=~f+1;ch=getchar();}
while (isdigit (ch)) {x=(x<<3)+(x<<1)+(ch^48);ch=getchar();}
x*=f;
}
template <typename T,typename... Args> inline void read(T& x, Args&... args) {
read(x);
read(args...);
}
template<typename T>inline void write(T x) {
static int buf[40],top=0;
if(x<0)putchar('-'),x=~x+1;
while(x)buf[++top]=x%10,x/=10;
if(top==0)buf[++top]=0;
while (top) putchar(buf[top--]^48);
putchar(' ');
}
template <typename T,typename... Args> inline void write(T x, Args... args) {
write(x);
write(args...);
}
int T;
ll a,b,c,x,y;
inline ll divup(ll x,ll y){
return (ll)ceil((x+0.0)/(y+0.0));
}
inline ll divdown(ll x,ll y){
return (ll)floor((x+0.0)/(y+0.0));
}
void exgcd(ll wa,ll wb,ll &x,ll &y){
if(wb==0){
x=1,y=0;
return;
}
exgcd(wb,wa%wb,x,y);
ll temp=x;
x=y;
y=temp-(wa/wb)*y;
}
int main(){
read(T);
while(T--){
read(a,b,c);
ll d=__gcd(a,b);
if(c%d!=0){
write(-1);
putchar('\n');
continue;
}
exgcd(a,b,x,y);
x*=(c/d),y*=(c/d);
if(divdown(-y,a)<divdown(x,b)){
write(divdown(x,b)-divdown(-y,a),(x%b+b)%b==0?b:(x%b+b)%b,(y%a+a)%a==0?a:(y%a+a)%a,x-divup(-y,a)*b,y+divdown(x,b)*a);
}
else {
write((x%b+b)%b==0?b:(x%b+b)%b,(y%a+a)%a==0?a:(y%a+a)%a);
}
putchar('\n');
}
return 0;
}