#include <bits/stdc++.h>
long long n;
int main() {
  scanf("%I64d", &n);
  if (n == 0) {
    puts("0 0");
    return 0;
  }
  long long l = 1, r = 1000000000, mid = (l + r + 1) >> 1;
  while (l < r) {
    if (3ll * mid * mid - 3 * mid > n)
      r = mid - 1;
    else
      l = mid;
    mid = (l + r + 1) >> 1;
  }
  n = n - 3 * mid * (mid - 1);
  if (n == 0) {
    printf("%I64d 0\n", 2ll * mid - 2);
    return 0;
  }
  long long len = mid + 1;
  long long tmp[8];
  tmp[1] = 0;
  for (int i = 2; i <= 6; i++) tmp[i] = tmp[i - 1] + len - 1;
  if (n >= tmp[1] && n <= tmp[2])
    printf("%I64d %I64d\n", 2ll * len - 2 - n, 2 * n);
  else if (n >= tmp[2] && n <= tmp[3])
    printf("%I64d %I64d\n", len - 1 - 2 * (n - tmp[2]), 2 * len - 2);
  else if (n >= tmp[3] && n <= tmp[4])
    printf("%I64d %I64d\n", 1 - len - (n - tmp[3]),
           2 * len - 2 - 2 * (n - tmp[3]));
  else if (n >= tmp[4] && n <= tmp[5])
    printf("%I64d %I64d\n", 2 - 2 * len + (n - tmp[4]), -2 * (n - tmp[4]));
  else if (n >= tmp[5] && n <= tmp[6])
    printf("%I64d %I64d\n", 1 - len + 2 * (n - tmp[5]), 2 - 2 * len);
  else
    printf("%I64d %I64d\n", len - 1 + (n - tmp[6]),
           2 - 2 * len + 2 * (n - tmp[6]));
  return 0;
}
