#include <bits/stdc++.h>
using namespace std;
#define int long long
#define fi first
#define se second
#define pb push_back
#define rep(i, s, n) for (int i = s; i < n; i++)
#define rrep(i, s, n) for (int i = (n)-1; i >= (s); i--)
#define all(a) a.begin(),a.end()
const long long MOD = 1e9+7, INF = 1e18;
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}





signed main(){
	IOS();
	vector<pair<int,int>>ans;
	int N;
	while(cin>>N,N){
		int ret = -1,a;
		N*=2;
		for(int i = 1;i*i<=N;i++){
			if(N%i)continue;
			int t = N;
			t/=i;
			t-=i;
			t+=1;
			if(t>1&&t%2==0)if(chmax(ret,i))a = t/2;
			t = N;
			t/=N/i;
			t-=N/i;
			t+=1;
			if(t>1&&t%2==0)if(chmax(ret,N/i))a = t/2;
		}
		ans.push_back({ret,a});
	}
	for(auto e:ans){
		cout<<e.se<<" "<<e.fi<<endl;
	}
}
