#include <bits/stdc++.h>
using namespace std;
long long n;
long long dx[] = {-1, -2, -1, 1, 2, 1};
long long dy[] = {-2, 0, 2, 2, 0, -2};
long long getmin(long long x, long long y) { return x < y ? x : y; }
void conduct() {
  if (!n) {
    printf("0 0\n");
    return;
  }
  long long lst = 0L, mst = 1000000000L;
  while (lst < mst) {
    long long mid = (lst + mst + 1) >> 1L;
    long long val = 3 * mid * mid + 3 * mid;
    if (val >= n)
      mst = mid - 1;
    else
      lst = mid;
  }
  n -= 3 * lst * lst + 3 * lst + 1;
  ++lst;
  n = 6 * lst - 1 - n;
  long long x = 2 * lst, y = 0;
  for (int i = 0; i < 6; ++i) {
    long long dlt = getmin(n, lst);
    x += dlt * dx[i];
    y += dlt * dy[i];
    n -= dlt;
  }
  cout << x << " " << y << endl;
}
int main() {
  while (cin >> n) conduct();
  return 0;
}
