//* Problem  : 1218 - Bee Maja
//* Contest  : acm.tju.edu.cn
//* Origin   : University of Ulm Local Contest 1999
//* Type     : Solution
//* Date     : 2008.06.06
//* Author   : alt
//* Language : C++
//* Compiler : Microsoft Visual C++ 8.0

#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>

#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <string>
#include <iostream>
using namespace std;
#define int64 long long
#define INF 1000000000
#define EPS 1E-8

#define ALL(a) a.begin(), a.end()
#define PB(a, v) a.push_back(v)
#define MP(a,b) make_pair(a, b)
#define FOR(i, n) for (int i = 0; i < (int)(n); i++)
#define FORO(i, obj) for (int i = 0; i < (int)(obj.size); i++)

int x, y, X[110100], Y[110100], n, k;

void down(int n)
{
	while (n--)
	{
		X[k] = x; Y[k] = y; y++; k++;
	}
}

void up(int n)
{
	while (n--)
	{
		X[k] = x; Y[k] = y; y--; k++;
	}
}

void up_left(int n)
{
	while (n--)
	{
		X[k] = x; Y[k] = y; x--; k++;
	}
}

void up_right(int n)
{
	while (n--)
	{
		X[k] = x; Y[k] = y; x++; y--; k++;
	}
}

void down_left(int n)
{
	while (n--)
	{
		X[k] = x; Y[k] = y; x--; y++; k++;
	}
}

void down_right(int n)
{
	while (n--)
	{
		X[k] = x; Y[k] = y; x++; k++;
	}
}

void fill()
{
	x = y = 0; k = 1;
	down(1);
	for (int scale = 1; k <= 100000; scale++)
	{
		up_left(scale);
		up(scale);
		up_right(scale);
		down_right(scale);
		down(scale + 1);
		down_left(scale);
	}
}

int main()
{
#ifdef _DEBUG
	freopen("1166.in", "r", stdin);
#endif
	fill();
	while (scanf("%d", &n) == 1)
	{
#ifdef _DEBUG
		printf("%d ", n);
#endif
		printf("%d %d\n", X[n], Y[n]);
	}
	return 0;
}
