#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<ll,ll> P;
typedef pair<ll,P> PP;
const ll MOD = 1e9+7;

int main(){
  ll b;
  while(cin>>b,b){
	int mi,sum;
	for(int i=1;;i++){
	  if(i*(i+1)/2>b)break;
	  if((b-i*(i+1)/2)%i==0){
		mi=1+(b-i*(i+1)/2)/i;
		sum=i;
	  }
	}
	cout<<mi<<" "<<sum<<endl;
  }
  return 0;
}

