#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<utility>
#include<map>
#include<set>
#include<string>

using namespace std;
#define ll long long

int main(){
    ll b= 1;
    while(b > 0){
        cin >> b;
        if(b==0)break;
        ll a = 0, c = 0;
        ll kai = 0;
        ll first = 0;

        while(1){
            c++;
            a = b/c - (c-1)/2;
            if( (2*b -(c*c)+c) % (2*c) == 0 && a > 0){ 
                kai = c;
                first = a;
            }
            if(a < 0) break;
        }
        cout << first << " " << kai << endl;
    }


}
