#define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#define INF          1e9
#define INFLL        1e18
#define EPS          1e-9
#define MOD          1000000007
#define REP(i,n)     for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)    for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)    for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)   for(ll i=(n);i>0;--i)
#define REPC(i,obj)  for(auto i:obj)
#define ALL(obj)     (obj).begin(),(obj).end()
#define SETP(n)      cout<<fixed<<setprecision(n)
#define VV(T,h,w)    vector<vector<T>>(h,vector<T>(w))
#define VVI(T,h,w,i) vector<vector<T>>(h,vector<T>(w,i))
using namespace std;
using ll = long long;
template<typename T = ll>inline T in() { T ret; cin >> ret; return ret; }

int main()
{
    /* S(x)=x(1+x)/2
       S([x,y))=S(y-1)-S(x-1)
               =(y-1)y/2-(x-1)x/2
               ={(y-1)y-(x-1)x}/2
       S([x,x+a))={(x+a-1)(x+a)-(x-1)x}/2
                 =a(2x+a-1)/2
       b=a(2x+a-1)/2
       2ax-a-2b+a^2=0
       x=(a+2b-a^2)/2a
    */
    while (true) {
        ll b = in();
        if (b == 0)break;
        for (ll a = static_cast<ll>(sqrt(b)) * 2;; --a) {
            if ((a + 2 * b - a * a) % (2 * a) == 0) {
                ll x = (a + 2 * b - a * a) / (2 * a);
                if (x >= 1) {
                    cout << x << ' ' << a << endl;
                    break;
                }
            }
        }
    }
}
