#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9;
long long get_sum(long long n) {
  long long ans = 3ll * n * n + 2 * n;
  return ans;
}
void solve() {
  long long n;
  cin >> n;
  if (!n) {
    cout << "0 0";
    return;
  } else if (n == 1) {
    cout << "1 2";
    return;
  }
  long long lf = 1, rg = INF;
  while (lf + 1 < rg) {
    long long md = (lf + rg) >> 1;
    if (get_sum(md) > n) {
      rg = md;
    } else {
      lf = md;
    }
  }
  long long cnt = -1;
  if (get_sum(lf) > n) {
    cnt = lf - 1;
  } else {
    cnt = lf;
  }
  long long done = get_sum(cnt);
  long long k = cnt + 1, x = cnt, y = -cnt * 2;
  long long k2 = cnt;
  for (;;) {
    if (done + k >= n) {
      long long rest = n - done;
      x += rest;
      y += rest * 2;
      cout << x << " " << y;
      return;
    } else {
      done += k;
      x += k;
      y += k * 2;
      if (done + k2 >= n) {
        long long rest = n - done;
        x -= rest;
        y += rest * 2;
        cout << x << " " << y;
        return;
      } else {
        done += k2;
        x -= k2;
        y += k2 * 2;
        if (done + k >= n) {
          long long rest = n - done;
          x -= rest * 2;
          cout << x << " " << y;
          return;
        } else {
          done += k;
          x -= k * 2;
          if (done + k >= n) {
            long long rest = n - done;
            x -= rest;
            y -= rest * 2;
            cout << x << " " << y;
            return;
          } else {
            done += k;
            x -= k;
            y -= k * 2;
            if (done + k >= n) {
              long long rest = n - done;
              x += rest;
              y -= rest * 2;
              cout << x << " " << y;
              return;
            } else {
              done += k;
              x += k;
              y -= k * 2;
              if (done + k >= n) {
                long long rest = n - done;
                x += rest * 2;
                cout << x << " " << y;
                return;
              } else {
                done += k;
                x += k * 2;
              }
            }
          }
        }
      }
    }
    k++;
    k2++;
  }
}
int main() {
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
