#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; bool check(long long a, long long b, int x) { while(a < x){ a += b; swap(a, b); } return a == x; } void backInit(long long& a, long long& b) { while(0 < b - a && b - a <= a){ b -= a; swap(a, b); } } int main() { vector x(3); for(int i=0; i<3; ++i) cin >> x[i]; sort(x.begin(), x.end()); if(x[2] == 1){ cout << 1 << ' ' << 1 << endl; return 0; } if(x[0] == x[2]) x[0] = 1; else if(x[0] == x[1]) x[1] = x[2]; pair ans(LLONG_MAX, LLONG_MAX); pair curr(0, 1), prev(1, 0); for(;;){ long long a = x[0]; long long tmp = x[1] - curr.first * a; if(tmp <= 0) break; if(tmp % curr.second == 0){ long long b = tmp / curr.second; if(check(a, b, x[2])){ backInit(a, b); ans = min(ans, make_pair(a, b)); } } prev.first += curr.first; prev.second += curr.second; swap(curr, prev); } if(ans.first == LLONG_MAX) cout << -1 << endl; else cout << ans.first << ' ' << ans.second << endl; return 0; }