    #include <bits/stdc++.h>
#define pb push_back
 #define int long long
 using namespace std;


vector<int>ve;
void solve(){
	int n;
cin>>n;
	if(n==0) exit(0);
	ve.clear();
	
	for(int i=1;i*i<=n;i++){
		if(n%i) continue;
		if(i*i==n)ve.pb(i);
	else ve.pb(i),ve.pb(n/i);
	}
	
	int lo=0,si;
	
	for(auto v:ve){
		if(v%2==0) continue;
		
		int no=n/v;
		if(2*no-v+1>=2){
			if(lo<v){
				lo=v;
				si=no-(v-1)/2;
			}	
		}
		if(v-2*no>=1){
			if(lo<2*no){
				lo=2*no;
				si=(v-2*no+1)/2;
			}
		}
	}
	cout<<si<<" "<<lo<<endl;

}

    signed main(){
               cin.tie(0);
    		ios::sync_with_stdio(false);

    int t;
    	//cin>>t;
    	for(int i=0;;i++){
    		solve();
    	
    	}
    	return 0;
    	
            }
