#include <bits/stdc++.h>
#define MOD 1000000007
typedef long long ll;
using namespace std;

ll b;

void solve(){
    int ans=1;
    int mi=b;
    ll sum=0;
    for(int i=2;;i++){
        sum+=i-1;
        if(sum>=b) break;
        if((b-sum)%i==0){
            ans=i;
            mi=(b-sum)/i;
        }
    }

    cout<<mi<<" "<<ans<<endl;
}

int main(){
  while(1){
      cin>>b;
      if(b==0) break;
      solve();
  }

  return 0;
}

