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

int b;

vector<int> divisor(int n){
    vector<int> res;
    for (int i=1;i*i<=n;++i) if (n%i==0){
        res.emplace_back(i);
        if (i!=n/i) res.emplace_back(n/i);
    }
    return res;
}

void solve(){
    vector<int> cand=divisor(2*b);
    int M=0,ans0,ans1;
    for (int c:cand){
        int a=2*b/c+1-c;
        if (a<=0||a&1) continue;
        if (M<c) ans0=a/2,ans1=c;
    }
    cout << ans0 << ' ' << ans1 << '\n';
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(cin >> b,b) solve();
}
