#include <bits/stdc++.h>
using namespace std;
long long int mv1[2] = {1, 2};
long long int mv2[6][2] = {-2, 0, -1, -2, 1, -2, 2, 0, 1, 2, -1, 2};
int main() {
  long long int n;
  scanf("%lld", &n);
  long long int l = 0, r = 580000000;
  while ((r - l) > 1) {
    long long int mid = (l + r) >> 1;
    if (mid * (3 * mid - 2) <= n) {
      l = mid;
    } else {
      r = mid;
    }
  }
  long long int sx = mv1[0] * l;
  long long int sy = mv1[1] * l;
  long long int lst = n - l * (3 * l - 2);
  if (lst == 0) {
    printf("%lld %lld\n", sx, sy);
    return 0;
  } else {
    long long int b = lst / l;
    if (b < 5) {
      long long int tx = 0, ty = 0;
      for (int i = 0; i < b; i++) {
        tx += mv2[i][0];
        ty += mv2[i][1];
      }
      tx *= l;
      ty *= l;
      sx += tx;
      sy += ty;
      lst -= (b * l);
      sx += (mv2[b][0] * lst);
      sy += (mv2[b][1] * lst);
      printf("%lld %lld\n", sx, sy);
      return 0;
    } else {
      long long int tx = 0, ty = 0;
      for (int i = 0; i < 5; i++) {
        tx += mv2[i][0];
        ty += mv2[i][1];
      }
      tx *= l;
      ty *= l;
      sx += tx;
      sy += ty;
      lst -= (5 * l);
      if (lst) {
        sx += 1;
        sy += 2;
        lst--;
        if (lst) {
          sx += (lst * (-1));
          sy += (lst * 2);
        }
      }
      printf("%lld %lld\n", sx, sy);
      return 0;
    }
  }
}
