#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>

using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;

#define INF (1e9)

int B;

int main() {
    while (true) {
        cin >> B;
        if (B == 0) break;

        int S = B, N = 1;
        for (int i = 2; i * i < 2 * B; i++) {
            int r = 2 * B / i;
            if (r * i != 2 * B) continue;
            if (i % 2 == r % 2) continue;
            S = (r - i + 1) / 2;
            N = i;
        }

        cout << S << ' ' << N << endl;
    }
    return 0;
}

