#include <bits/stdc++.h>
using namespace std;
long double const PI = 3.14159265358979323;
long long mod = 1000000007;
long long binpow(long long a, long long n) {
  if (n == 0) return 1;
  if (n % 2 == 1)
    return (binpow(a, n - 1) * a);
  else {
    long long b = binpow(a, n / 2);
    return (b * b);
  }
}
vector<long long> zf(string s) {
  long long n = (long long)s.length();
  vector<long long> z(n);
  for (long long i = 1, l = 0, r = 0; i < n; ++i) {
    if (i <= r) z[i] = min(r - i + 1, z[i - l]);
    while (i + z[i] < n && s[z[i]] == s[i + z[i]]) ++z[i];
    if (i + z[i] - 1 > r) l = i, r = i + z[i] - 1;
  }
  return z;
}
int main() {
  ios_base::sync_with_stdio(0);
  long long n;
  cin >> n;
  long long l = 0;
  long long r = 1e9;
  long long m;
  for (long long j = 0; j < (100); j++) {
    m = (r + l) / 2;
    if (3 * m * (m + 1) > n) {
      r = m;
    } else {
      l = m;
    }
  }
  n -= 3 * m * (m + 1);
  long long a, b;
  a = 2 * m;
  b = 0;
  m += 1;
  if (n == 0) {
    cout << a << " " << b;
    return 0;
  } else {
    if (n == 1) {
      a += 1;
      b += 2;
      cout << a << " " << b;
      return 0;
    }
    a += 1;
    b += 2;
    n -= 1;
    if (n <= m - 1) {
      a -= n;
      b += 2 * n;
      cout << a << " " << b;
      return 0;
    }
    a -= m - 1;
    b += 2 * (m - 1);
    n -= m - 1;
    if (n <= m) {
      a -= 2 * n;
      cout << a << " " << b;
      return 0;
    }
    a -= 2 * m;
    n -= m;
    if (n <= m) {
      a -= n;
      b -= 2 * n;
      cout << a << " " << b;
      return 0;
    }
    a -= m;
    b -= 2 * m;
    n -= m;
    if (n <= m) {
      a += n;
      b -= 2 * n;
      cout << a << " " << b;
      return 0;
    }
    a += m;
    b -= 2 * m;
    n -= m;
    if (n <= m) {
      a += 2 * n;
      cout << a << " " << b;
      return 0;
    }
    a += 2 * m;
    n -= m;
    a += n;
    b += 2 * n;
    cout << a << " " << b;
  }
  return 0;
}
