#include <bits/stdc++.h>
using namespace std;
long long x = 0;
int main() {
  long long step;
  cin >> step;
  long long S = step / 6;
  long long n = (-1 + sqrt(S * 8 + 1)) / 2;
  long long st = step - 6 * ((1 + n) * n) / 2;
  long long x, y;
  x = 2 * n + 2;
  y = 0;
  n++;
  long long a;
  if (st == 0) {
    cout << 2 * (n - 1) << " " << 0;
    return 0;
  }
  if (st > 0) {
    a = min(st, n);
    x -= a;
    y += a * 2;
    st -= n;
  }
  if (st > 0) {
    a = min(st, n);
    x -= 2 * a;
    st -= n;
  }
  if (st > 0) {
    a = min(st, n);
    x -= a;
    y -= 2 * a;
    st -= n;
  }
  if (st > 0) {
    a = min(st, n);
    x += a;
    y -= 2 * a;
    st -= n;
  }
  if (st > 0) {
    a = min(st, n);
    x += 2 * a;
    st -= n;
  }
  if (st > 0) {
    a = min(st, n);
    x += a;
    y += 2 * a;
    st -= n;
  }
  cout << x << " " << y;
  return 0;
}
