#include <bits/stdc++.h>
using namespace std;
long long n, cnt, cnt2, cnt3, ansx, ansy;
long long read() {
  long long x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = (x << 1) + (x << 3) + (c ^ 48);
    c = getchar();
  }
  return x * f;
}
long long lower_b(long long x) {
  long long l = 1, r = 1e9, mid, res;
  while (l <= r) {
    mid = (l + r) >> 1;
    if (mid * (mid - 1) / 2 <= x)
      res = mid, l = mid + 1;
    else
      r = mid - 1;
  }
  return res;
}
signed main() {
  n = read();
  if (!n) puts("0 0"), exit(0);
  long long x = n;
  cnt = lower_b((x - 1) / 6);
  long long y = cnt * 6;
  x -= cnt * (cnt - 1) * 3;
  cnt2 = (x - 1) % (y / 6);
  cnt3 = (x - 1) / (y / 6) + 1;
  if (cnt3 == 1) {
    ansx = cnt * 2 - 1;
    ansy = 2;
    ansx -= cnt2;
    ansy += cnt2 * 2;
    printf("%lld %lld\n", ansx, ansy);
  }
  if (cnt3 == 2) {
    ansx = cnt - 2;
    ansy = cnt * 2;
    ansx -= cnt2 * 2;
    printf("%lld %lld\n", ansx, ansy);
  }
  if (cnt3 == 3) {
    ansx = -cnt - 1;
    ansy = (cnt - 1) * 2;
    ansx -= cnt2;
    ansy -= cnt2 * 2;
    printf("%lld %lld\n", ansx, ansy);
  }
  if (cnt3 == 4) {
    ansx = -1 - ((cnt - 1) * 2);
    ansy = -2;
    ansx += cnt2;
    ansy -= cnt2 * 2;
    printf("%lld %lld\n", ansx, ansy);
  }
  if (cnt3 == 5) {
    ansx = 2 - cnt;
    ansy = -(cnt * 2);
    ansx += cnt2 * 2;
    printf("%lld %lld\n", ansx, ansy);
  }
  if (cnt3 == 6) {
    ansx = cnt + 1;
    ansy = -(cnt - 1) * 2;
    ansx += cnt2;
    ansy += cnt2 * 2;
    printf("%lld %lld\n", ansx, ansy);
  }
  return 0;
}
