#include <algorithm>
#include <cstdint>
#include <iostream>
#include <tuple>

using ll = int64_t;

ll T;

std::tuple<ll,ll,ll> exgcd(ll const&a,ll const& b){
    if(b==0){
        return std::make_tuple(a,1,0);
    }
    auto [d,x,y] = exgcd(b, a%b);
    ll oldy{y};
    y=x-a/b*y;
    x=oldy;
    return std::make_tuple(d,x,y);
}

ll divup(ll const&a,ll const&b){
    return (a+(b>0?b-1:b+1))/b;
}

int main(){
    std::cin>>T;
    while(T--){
        const auto [a,b,c] {[]()->std::tuple<ll,ll,ll>{ll a,b,c;std::cin>>a>>b>>c;return std::make_tuple(a,b,c);}()};
        const auto [d,x1,y1] {exgcd(a,b)};
        if(c%d!=0){
            std::cout<<"-1\n";
            continue;
        }
        const ll kmin{divup(-x1*d,b)},kmax{y1*d/a};
        const ll knum{std::max(ll(0),kmax-kmin+1)};
        if(knum==0){
            std::cout<<(x1+kmax*b/d)<<' '<<(y1-kmin*a/d)<<'\n';
        }else{
            std::cout<<(x1+kmin*b/d)<<' '<<(y1-kmax*a/d)<<(x1+kmax*b/d)<<' '<<(y1-kmin*a/d)<<'\n';
        }
    }
}