#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <chrono>
#include <random>
#include <tuple>
#include <utility>
#include <fstream>

const long INF = (1l << 30);
const long LINF = (1l << 60);


void solve(long n){
	for(long b = 50000; b > 0; b--){
		if((2*n - b*(b-1)) % (2*b) == 0 && (2*n - b*(b-1)) / (2*b) > 0){
			long a = (2*n - b*(b-1)) / (2*b);
			printf("%ld %ld\n", a, b);
			return;
		}
	}
}

int main(){
	while(1){
		long b;
		scanf("%ld", &b);
		if(b == 0){
			return 0;
		}else{
			solve(b);
		}
	}
}

