/***********Template Starts Here***********/ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define pb push_back #define nl puts ("") #define sp printf ( " " ) #define phl printf ( "hello\n" ) #define ff first #define ss second #define POPCOUNT __builtin_popcountll #define RIGHTMOST __builtin_ctzll #define LEFTMOST(x) (63-__builtin_clzll((x))) #define MP make_pair #define FOR(i,x,y) for(vlong i = (x) ; i <= (y) ; ++i) #define ROF(i,x,y) for(vlong i = (y) ; i >= (x) ; --i) #define CLR(x,y) memset(x,y,sizeof(x)) #define UNIQUE(V) (V).erase(unique((V).begin(),(V).end()),(V).end()) #define MIN(a,b) ((a)<(b)?(a):(b)) #define MAX(a,b) ((a)>(b)?(a):(b)) #define NUMDIGIT(x,y) (((vlong)(log10((x))/log10((y))))+1) #define SQ(x) ((x)*(x)) #define ABS(x) ((x)<0?-(x):(x)) #define FABS(x) ((x)+eps<0?-(x):(x)) #define ALL(x) (x).begin(),(x).end() #define LCM(x,y) (((x)/gcd((x),(y)))*(y)) #define SZ(x) ((vlong)(x).size()) #define NORM(x) if(x>=mod)x-=mod; #define MOD(x,y) (((x)*(y))%mod) #define ODD(x) (((x)&1)==0?(0):(1)) using namespace std; typedef long long vlong; typedef unsigned long long uvlong; typedef pair < vlong, vlong > pll; typedef vector vll; typedef vector vl; const vlong inf = 2147383647; const double pi = 2 * acos ( 0.0 ); const double eps = 1e-9; #ifdef forthright48 #include clock_t tStart = clock(); #define debug(args...) {dbg,args; cerr< debugger& operator , (const T& v){ cerr<>= 1; } return res; } inline vlong bigmod ( vlong a, vlong p, vlong m ) { vlong res = 1 % m, x = a % m; while ( p ) { if ( p & 1 ) res = ( res * x ) % m; x = ( x * x ) % m; p >>= 1; } return res; } /***********Template Ends Here***********/ int main () { #ifdef forthright48 //freopen ( "input.txt", "r", stdin ); //freopen ( "output.txt", "w", stdout ); #endif // forthright48 int kase; scanf ( "%d", &kase ); while ( kase-- ) { int a, b, c; scanf ( "%d %d %d", &a, &b, &c ); if ( (c%2) != 0 ) { printf ( "Impossible\n" ); continue; } c = c / 2; int resa = 10000000, resb = 100000000; FOR(i,0,1000000){ int tot = a * i; if ( tot > c ) break; int need = c - tot; if ( ( need % b ) == 0 ) { int j = need / b; if ( i + j < resa + resb ) { resa = i; resb = j; } } } if ( resa != 10000000 ) { printf ( "%d %d\n", resa * 2, resb * 2 ); } else printf ( "Impossible\n" ); } return 0; }