#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
typedef pair<int,int> PP;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//#define int ll
#define setdouble setprecision
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define GOODBYE cout << -1 << endl;return 0
#define MM <<" "<<
#define Endl endl

int main(){
  int N,a,i;
  while(cin >> N && N!=0){
    for(int k=1;k<=N;k++){
      if((2*N)/k -k+1<=0)break;
      if(2*N%k!=0)continue;
      if(((2*N)/k -k+1)%2!=0)continue;
      a=((2*N)/k -k+1)/2;
      i=k;
    }
    cout << a << " " << i << endl;
  }
  return 0;
}

