#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N = 1e8 + 10;
void exgcd(int a,int b,int &x,int &y){
if(b==0){
x=1;b=0;
return;
}
int x1,y1;
exgcd(b,a%b,x1,y1);
x=y1;
y=x1-(a/b)*y1;
return;
}
void solve(){
int a,b,c;
cin>>a>>b>>c;
int g=__gcd(a,b);
if(c%g!=0){
cout<<-1<<endl;
return;
}
int x,y;
exgcd(a,b,x,y);
x=x*c/g;y=y*c/g;
int l=ceil((-1.0*x+1)/(b/g)),r=floor((1.0*y-1)/(a/g));
if(l<=r)
cout<<r-l+1<<" ";
cout<<x+l*b/g<<" "<<y-r*a/g;
if(l<=r)
cout<<" "<<x+r*b/g<<" "<<y-l*a/g;
cout<<endl;
return;
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
int t;
cin>>t;
while(t--)
solve();
return 0;
}
#4数据:
输入:
10
29 54 93
3 7 15
83 29 91
7 7 59
4 2 1
10 4 95
16 51 42
2 10 9
8 11 31
4 10 87
输出:
33 13
5 3
28 6
-1
-1
-1
9 14
-1
8 5
-1