#include <bits/stdc++.h>
using namespace std;
const long long B = 1000000000;
int main() {
  long long n;
  cin >> n;
  if (n == 0) {
    printf("0 0\n");
    return 0;
  }
  long long st = 0, en = B;
  while (st + 1 < en) {
    long long mid = (st + en) >> 1;
    long long nm = 3ll * (1ll + mid) * mid;
    if (nm >= n)
      en = mid;
    else
      st = mid;
  }
  long long num = n - 3ll * (1ll + st) * st;
  if (num == en * 6ll)
    printf("%I64d 0\n", 2ll * en);
  else if (num == 1)
    printf("%I64d 2\n", 2ll * st + 1);
  else if (num <= en)
    printf("%I64d %I64d\n", 2ll * st + 1 - (num - 1), num * 2ll);
  else if (num <= 2ll * en)
    printf("%I64d %I64d\n", en - 2ll * (num - en), en * 2);
  else if (num <= 3ll * en)
    printf("%I64d %I64d\n", -2ll * en + (3ll * en - num),
           (en - (num - en * 2ll)) * 2ll);
  else if (num <= 4ll * en)
    printf("%I64d %I64d\n", -2ll * en + (num - 3ll * en),
           -(num - 3ll * en) * 2ll);
  else if (num <= 5ll * en)
    printf("%I64d %I64d\n", -2ll * en + en + 2ll * (num - 4ll * en), -en * 2ll);
  else if (num <= 6ll * en)
    printf("%I64d %I64d\n", en + (num - en * 5ll),
           (-en + (num - en * 5ll)) * 2ll);
  return 0;
}
