#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define FOR_EACH_C (p,c) for(p=(c).begin(); p!=(c).end();p++) #define FOR_EACH (p, q, r) for(p=(q);p!=(r);p++) typedef vector ivec_t; typedef vector imat_t; #ifndef DEBUG #define cin fin ifstream fin("A.txt"); #endif #define debug cout const int INF=INT_MAX/2; bool Compare(int tx,int ty,int x,int y,int a,int b) { if(tx + ty < x + y)return true; if(tx + ty > x+y)return false; if(a*tx + b*ty <= a*x + b*y)return true; return false; } void Solve(int a,int b,int d,int& x,int& y) { x = y = INF; int tx=0,ty=0; while(true) { int tmp = tx*a + d; if(tmp % b == 0) { ty = tmp/b; if(Compare(tx,ty,x,y,a,b)) { x = tx; y = ty; } else break; } tx++; } } void Solve2(int a,int b,int d,int& x,int& y) { x = y = INF; int tx=0,ty=0; while(true) { int tmp = d-tx*a; if(tmp < 0)break; if(tmp % b == 0) { ty = tmp/b; if(Compare(tx,ty,x,y,a,b)) { x = tx; y = ty; } else break; } tx++; } } void SolveMain(int a,int b,int d,int& x,int& y) { int x1,y1; Solve(a,b,d,x,y); Solve2(a,b,d,x1,y1); if(Compare(x1,y1,x,y,a,b)) { x = x1; y = y1; } } int main() { int a , b,d; while(cin >> a >> b >> d , a || b || d) { int x1,y1,x2,y2; SolveMain(a,b,d,x1,y1); SolveMain(b,a,d,y2,x2); if(x1 + y1 < x2 + y2 || ((x1 + y1 == x2+y2) && (a*x1 + b*y1 < a*x2 + b*y2))) { cout << x1 << ' ' << y1 << endl; } else { cout << x2 << ' ' << y2 << endl; } } return 0; }