#include <iostream>

bool solve()
{
    int b;
    std::cin >> b;
    if (b == 0) {
        return false;
    }

    int sum = 0, L = 1, R = 1;
    while (true) {
        sum += R;
        R++;
        
        while (sum > b) {
            sum -= L;
            L++;
        }

        if (sum == b) {
            std::cout << L << " " << R - L << std::endl;
            break;
        }
    }

    return true;
}

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

