#include <bits/stdc++.h>
#define ll long long
#define p pair<ll, int>
using namespace std;

int main() {
    int b;
    while (cin >> b, b) {
        ll k = 1;
        vector<p> res;
        while (1) {
            ll idx = b / k;
            ll mmin;
            if (b % k == 0) {
                mmin = idx - k / 2;
            } else {
                mmin = idx - k / 2 + 1;
            }
            if (mmin <= 0) break;
            ll n = mmin + k - 1;
            ll m = mmin - 1;
            ll sum = n * (n + 1) / 2 - m * (m + 1) / 2;
            if (sum == b) res.push_back(p(mmin, k));
            k++;
        }
        ll mmax = -1;
        int f = 0;
        for (int i = 0; i < res.size(); i++) {
            if (mmax < res[i].second) {
                mmax = res[i].second;
                f = i;
            }
        }
        cout << res[f].first << " " << res[f].second << endl;
    }
    return 0;
}

