// made by diver_ru, made with love
#define _CRT_SECURE_NO_DEPRECATE
#include <cstdio>
#include <cmath>
#include <map>
#include <vector>
#include <string>
#include <set>
#include <queue>
#include <memory.h>
#include <deque>
#include <algorithm>

using namespace std;

FILE *fi = stdin, *fo = stdout;

int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
int dj[] = {1, 0, -1, 0, -1, 1, -1, 1};

int n;

int a[200][200];
const int MID = 100;


void readData(){
	fscanf(fi, "%d", &n);
}

void solve(){
	memset(a, -1, sizeof a);
	int i = MID, j = MID, dir = 0, delta = 1, cur = 0, mult = 0;
	for (int x = 0; x < 5000; ++x){
		a[i][j] = x;
		i += di[dir];
		j += dj[dir];
		++cur;
		if (cur == delta){
			cur = 0;
			++mult;
			if (mult == 2){
				mult = 0;
				++delta;
			}
			dir = (dir + 1) % 4;
		}
	}
}

void writeResult(){
	for (int i = 1; i < 199; ++i)
		for (int j = 1; j < 199; ++j){
			if (a[i][j] == -1)
				continue;
			for (int k = 0; k < 8; ++k){
				int ni = i + di[k], nj = j + dj[k];
				if (a[ni][nj] != -1 && a[ni][nj] + a[i][j] == n){
					fprintf(fo, "%d %d\n", a[i][j], a[ni][nj]);
					return;
				}
			}
		}
}

int main(){

	readData();
	solve();
	writeResult();
	return 0;
}
