#include <bits/stdc++.h>
using namespace std;
long long n, x, y;
long long erfen(long long x) {
  long long l = 1, r = 1e9, ans = 0;
  while (l <= r) {
    long long mid = (l + r) >> 1;
    if (3 * (mid + 1) * mid <= x)
      ans = mid, l = mid + 1;
    else
      r = mid - 1;
  }
  return ans;
}
int main() {
  scanf("%lld", &n);
  if (n == 0) {
    puts("0 0");
    return 0;
  }
  long long t1 = erfen(n);
  long long t2 = n - 3 * (t1 + 1) * t1;
  t1++;
  if (t2 == 0) {
    x = 2 * (t1 - 1);
    y = 0;
  } else {
    long long t3 = t2 / t1, t4 = t2 - t3 * t1;
    if (t3 == 0)
      x = 2 * t1 - t4, y = 2 * t4;
    else if (t3 == 1)
      x = t1 - t4 * 2, y = 2 * t1;
    else if (t3 == 2)
      x = -t1 - t4, y = 2 * (t1 - t4);
    else if (t3 == 3)
      x = -2 * t1 + t4, y = -2 * t4;
    else if (t3 == 4)
      x = -t1 + 2 * t4, y = -2 * t1;
    else if (t3 == 5)
      x = t1 + t4, y = 2 * (t4 - t1);
  }
  printf("%lld %lld\n", x, y);
  return 0;
}
