#include <iostream>
#include <fstream>
#include <string.h>
#include <stdio.h>
#include <set>
#include <cmath>
#include <vector>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#define ll long long
#define INF 1e9
#define PI acos(-1.0)
using namespace std;
ll f(int n) {
return n*(n+1)/2;
}
int main() {
while(1) {
int n;
cin >> n;
if(n==0)break;
int diff = 1e9; int x = 1,y=n;
for(int i = 1; i < n; i++) {
int left = i; int right = n;
int mid = 0;
while(right-left > 1) {
mid = (right+left)>>1;
int fir = f(mid)-f(i-1);
int sec = (f(n)-f(mid))+f(i-1);
if(fir < sec) left = mid;
else right = mid;
}
int newf = f(mid)-f(i-1);
int news = (f(n)-f(mid))+f(i-1);
int newd = abs(newf-news);
// printf("%d %d %d\n",i,mid,newd);
if(newd < diff) {
diff = newd;
x = i;
y = mid;
}
}
printf("%d %d\n",x,y);
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8ZnN0cmVhbT4KI2luY2x1ZGUgPHN0cmluZy5oPgojaW5jbHVkZSA8c3RkaW8uaD4KI2luY2x1ZGUgPHNldD4KI2luY2x1ZGUgPGNtYXRoPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8c3RyaW5nPgojaW5jbHVkZSA8Y3N0ZGlvPgojaW5jbHVkZSA8Y3N0ZGxpYj4KI2luY2x1ZGUgPHZlY3Rvcj4KI2luY2x1ZGUgPGFsZ29yaXRobT4KI2luY2x1ZGUgPG1hcD4KI2luY2x1ZGUgPHF1ZXVlPgojZGVmaW5lIGxsIGxvbmcgbG9uZwojZGVmaW5lIElORiAxZTkKI2RlZmluZSBQSSBhY29zKC0xLjApCnVzaW5nIG5hbWVzcGFjZSBzdGQ7CmxsIGYoaW50IG4pIHsKcmV0dXJuIG4qKG4rMSkvMjsKfQppbnQgbWFpbigpIHsKd2hpbGUoMSkgewogICAgaW50IG47CiAgICBjaW4gPj4gbjsKICAgIGlmKG49PTApYnJlYWs7CiAgICBpbnQgZGlmZiA9IDFlOTsgaW50IHggPSAxLHk9bjsKICAgIGZvcihpbnQgaSA9IDE7IGkgPCBuOyBpKyspIHsKICAgICAgICBpbnQgbGVmdCA9IGk7IGludCByaWdodCA9IG47CiAgICAgICAgaW50IG1pZCA9IDA7CiAgICAgICAgd2hpbGUocmlnaHQtbGVmdCA+IDEpIHsKICAgICAgICAgICAgIG1pZCA9IChyaWdodCtsZWZ0KT4+MTsKICAgICAgICAgICAgaW50IGZpciA9IGYobWlkKS1mKGktMSk7CiAgICAgICAgICAgIGludCBzZWMgPSAoZihuKS1mKG1pZCkpK2YoaS0xKTsKICAgICAgICAgICAgaWYoZmlyIDwgc2VjKSBsZWZ0ID0gbWlkOwogICAgICAgICAgICBlbHNlIHJpZ2h0ID0gbWlkOwogICAgICAgIH0KICAgICAgICBpbnQgbmV3ZiA9IGYobWlkKS1mKGktMSk7CiAgICAgICAgaW50IG5ld3MgPSAoZihuKS1mKG1pZCkpK2YoaS0xKTsKICAgICAgICBpbnQgbmV3ZCA9IGFicyhuZXdmLW5ld3MpOwogICAgIC8vICAgcHJpbnRmKCIlZCAlZCAlZFxuIixpLG1pZCxuZXdkKTsKICAgICAgICBpZihuZXdkIDwgZGlmZikgewogICAgICAgICAgICBkaWZmID0gbmV3ZDsKICAgICAgICAgICAgeCA9IGk7CiAgICAgICAgICAgIHkgPSBtaWQ7CiAgICAgICAgfQoKICAgIH0KICAgIHByaW50ZigiJWQgJWRcbiIseCx5KTsKfQpyZXR1cm4gMDsKfQo=