#include "iostream"
#include "random"
#include "string"
#include "bitset"
#include "algorithm"
#include "map"
#include "queue"
#include "list"
#include "set"
#include "climits"
#include "iomanip"
#include "stack"
#include "functional"

using namespace std;

int N, M, K, L, R, H, W;

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

	cin >> N;
	while (N) {
		N *= 2;
		for (int i = 100000; i >= 1; i--) {
			if (N%i)continue;
			M = N / i;
			M -= i - 1;
			if (M <= 0||M&1)continue;
			cout << M /2<< " " << i << endl;
			break;
		}
		cin >> N;
	}
}
