#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;

pair<ll, ll> invalid(-1, -1);

pair<ll, ll> check(ll l, ll B) {
    ll div = 2 * B / l;
    div -= (l - 1);
    if(div <= 0) return invalid;
    if(div & 1) return invalid;
    else return make_pair(div / 2, l);
}

void chmax(pair<ll, ll> &v1, pair<ll, ll> v2) { if(v1.second < v2.second) v1 = v2; }

bool solve() {
    ll B;
    cin >> B;
    if(!B) return false;
    auto ans = invalid;
    for(ll i = 1; i * i <= 2 * B; i++) {
        if(2 * B % i) continue;
        chmax(ans, check(i, B));
        chmax(ans, check(2 * B / i, B));
    }
    ll N, K;
    tie(N, K) = ans;
    cout << N << ' ' << K << endl;
    return true;
}

int main() {
    while(solve());
    return 0;
}

