#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
 
 
int main(){
    ios::sync_with_stdio(false);
	cin.tie(0);

    ll b;
    while(cin>>b){
        if(b==0)
            break;
        set<ll, greater<ll>> fac;
        for (ll i = 1; i * i <= b; i++)
        {
            if(b%i==0)
                fac.insert(i), fac.insert(b / i), fac.insert(2*i), fac.insert(2*(b / i));
        }
        for (auto k:fac){
            //cerr << k << endl;
            //k is length
            ll n = b/k;

            ll m = k * 2;
            if(k%2==0 && (b/(k/2))%2==1 && (b/(k/2))/2-k/2+1>0){
                cout <<  (b/(k/2))/2 - k/2 + 1 << " " << k << endl;
                break;
            }
            if(b%k)
                continue;

            if(k%2==1 && n-k/2>0){
                cout << n - k / 2 << " " << k << endl;
                break;
            }
        }
    }
    
}
