#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
const int INF = 0x3f3f3f3f;
const long long INFF = 0x3f3f;
const double pi = acos(-1.0);
const double inf = 1e18;
const double eps = 1e-9;
const long long mod = 1e9 + 7;
const unsigned long long mxx = 1333331;
inline void RI(int &x) {
  char c;
  while ((c = getchar()) < '0' || c > '9')
    ;
  x = c - '0';
  while ((c = getchar()) >= '0' && c <= '9') x = (x << 3) + (x << 1) + c - '0';
}
int main() {
  long long n;
  while (cin >> n) {
    if (n == 0)
      printf("0 0\n");
    else {
      long long tmp = sqrt(n / 3.0);
      while (3 * (1 + tmp) * tmp < n) tmp++;
      while (3 * (tmp - 1) * tmp >= n) tmp--;
      long long ret = n - 3 * (tmp - 1) * tmp;
      if (ret <= tmp - 1) {
        cout << 2 * tmp - ret << " " << 2 * ret << endl;
      } else if (ret <= 2 * tmp - 1) {
        cout << tmp - (ret - tmp) * 2 << " " << 2 * tmp << endl;
      } else if (ret <= 3 * tmp - 1) {
        cout << tmp - ret << " " << 2 * tmp - 2 * (ret - 2 * tmp) << endl;
      } else if (ret <= 4 * tmp - 1) {
        cout << -2 * tmp + (ret - 3 * tmp) << " " << 0 - 2 * (ret - 3 * tmp)
             << endl;
      } else if (ret <= 5 * tmp - 1) {
        cout << -tmp + 2 * (ret - 4 * tmp) << " " << -2 * tmp << endl;
      } else if (ret <= 6 * tmp) {
        cout << tmp + (ret - 5 * tmp) << " " << -2 * tmp + 2 * (ret - 5 * tmp)
             << endl;
      }
    }
  }
  return 0;
}
