#include <bits/stdc++.h>
#define dbg(x) std::cerr << #x << "=" << x << "\n"
using i64 = long long;
#define int i64

void exgcd(int &gcd, int a, int b, int& x, int& y){
    if(b == 0) {
        gcd = a,x = 1, y = 0;
        return ;
    }
    exgcd(gcd, b, a % b, x, y);
    int t = x;
    x = y;
    y = t - a / b * y;
}
void solve(){
    int a,b,c;
    std::cin >> a >> b >> c;

    int x0, y0, gcd;
    exgcd(gcd, a, b, x0, y0);
    //dbg(gcd);
    printf("for the equation \"%lldx + %lldy = %lld\"\n", a, b, c);
    if(c % gcd != 0){
        std::cout << "-1, no solutions\n\n";
        return;
    }
    //dbg(x0), dbg(y0);
    int x1 = x0 * c / gcd;
    int y1 = y0 * c / gcd;
    int dx = b / gcd;
    int dy = a / gcd;
    int low = std::ceil((-1.0 * x1 + 1.0) / dx);
    int high = std::floor((1.0 * y1 - 1.0) / dy );
    
    if(low > high){
        std::cout << "min(x): " << x1 + low * dx << " " << "min(y): " << y1 - high * dy << "\n\n";
        return ;
    }
    std::cout << "solutions of (x,y): " << high - low + 1 << "\n";
    std::cout << "min(x): " << x1 + low * dx << "\n";
    std::cout << "min(y): " << y1 - high * dy << "\n";
    std::cout << "max(x): " << x1 + high * dx << "\n";
    std::cout << "max(y): " << y1 - low * dy << "\n";
    std::cout << '\n';
}
signed main(){

    int t;
    std::cin >> t;
    while(t--){
        solve();
    }
    return 0;
}