#include <bits/stdc++.h>
int ax[6] = {1, -1, -2, -1, 1, 2};
int ay[6] = {2, 2, 0, -2, -2, 0};
int bx[6] = {2, 1, -1, -2, -1, 1};
int by[6] = {0, 2, 2, 0, -2, -2};
int cx[6] = {-1, -2, -1, 1, 2, 1};
int cy[6] = {2, 0, -2, -2, 0, 2};
int main() {
  long long n;
  scanf("%I64d", &n);
  if (n == 0) {
    printf("0 0\n");
    return 0;
  }
  long long tmp1 = n / 3;
  long long tmp2 = sqrt(tmp1);
  long long tmp3;
  for (long long i = tmp2 - 1; i <= tmp2 + 1; i++) {
    if (3 * i * (i - 1) + 1 <= n && n <= 3 * i * (i + 1)) {
      tmp3 = i;
      break;
    }
  }
  long long tmp4 = n - (3 * (tmp3 - 1) * tmp3) - 1;
  long long tmp5 = tmp4 / tmp3;
  long long tmp6 = tmp4 % tmp3;
  long long x = ax[tmp5] + bx[tmp5] * (tmp3 - 1) + cx[tmp5] * tmp6;
  long long y = ay[tmp5] + by[tmp5] * (tmp3 - 1) + cy[tmp5] * tmp6;
  printf("%I64d %I64d\n", x, y);
  return 0;
}
