#include <bits/stdc++.h>
using namespace std;
const long long linf = 1000000000000000043;
const int inf = 1000000043;
void pause(bool a = true) {}
template <class T>
inline T prod(pair<T, T> a, pair<T, T> b, pair<T, T> c = make_pair(0, 0)) {
  return (a.first - c.first) * (b.second - c.second) -
         (a.second - c.second) * (b.first - c.first);
}
template <class T>
inline bool intriangle(pair<T, T> a, pair<T, T> b, pair<T, T> c, pair<T, T> d) {
  return (abs(prod(a, b, c)) ==
          abs(prod(a, b, d)) + abs(prod(a, c, d)) + abs(prod(b, c, d)));
}
template <class T>
inline int sg(T a) {
  return (a < 0 ? -1 : a ? 1 : 0);
}
long long rng(long long a, long long b) {
  return (((((long long)rand()) << 16) + rand()) % (b - a + 1)) + a;
}
bool inConvPoly(const vector<pair<long long, long long>> &a,
                pair<long long, long long> b) {
  long long l = 1;
  long long r = a.size() - 1;
  if (sg(prod(a[l], b, a[0])) * sg(prod(a[r], b, a[0])) >= 0) return false;
  if (intriangle(a[l], a[r], a[0], b)) return true;
  while (l != r - 1)
    (prod(a[(l + r) / 2], b, a[0]) < 0) ? l = (l + r) / 2 : r = (l + r) / 2;
  return sg(prod(b, a[r], a[l])) * sg(prod(b, a[0], a[l])) < 0;
}
template <class T>
T mex(vector<T> a) {
  set<T> b(a.begin(), a.end());
  for (int i = 0;; ++i)
    if (!b.count(i)) return i;
}
long long gcd(long long a, long long b) {
  while (b) {
    a %= b;
    swap(a, b);
  }
  return a;
}
long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
template <class T>
inline const T sqr(const T &x) {
  return x * x;
}
unsigned long long powi(unsigned long long a, unsigned long long b,
                        long long mod = 1000000007) {
  if (b < 2) return b ? a : 1;
  return (powi((a * a) % mod, b / 2, mod) * (b % 2 ? a : 1)) % mod;
}
bool isn(char c) { return ('0' <= c && c <= '9'); }
template <class T>
bool read(T &out) {
  int c = getchar(), sign = 1;
  T num = 0;
  for (; !isn(c) && c != '-'; c = getchar())
    if (c == EOF) return false;
  if (c == '-') {
    sign = -1;
    c = getchar();
  }
  if (c == EOF) return false;
  for (; isn(c); c = getchar()) num = num * 10 + c - '0';
  out = sign * num;
  return true;
}
long long time_limit = 1000000;
long long start = clock();
bool time_break() {
  int g = clock();
  return (clock() - start > time_limit * 0.8);
}
long long fact(long long n, long long mod = linf) {
  long long g = 1;
  for (int i = 0; i < (n); i++) g *= (i + 1);
  return g;
}
void init(long long tl = 1000000) {
  ios::sync_with_stdio(false);
  srand(time(0));
  time_limit = tl;
}
template <class T>
void maxz(T &a, T b) {
  a = max(a, b);
}
template <class T>
void minz(T &a, T b) {
  a = min(a, b);
}
long long mod7 = 1000000007;
long long mod9 = 1000000009;
bool isprime(long long n) {
  if (n < 2) return 0;
  for (long long i = 2; i * i <= n; i++)
    if (n % i == 0) return 0;
  return 1;
}
long long randLL() {
  return (((long long)rand()) << 47) + (((long long)rand()) << 31) +
         (((long long)rand()) << 15) + (((long long)rand()) >> 1);
}
bool isprimeL(long long n, int it = 50) {
  if (n < 2) return 0;
  if (n == 2) return 1;
  if (n % 2 == 0) return 0;
  for (int i = 0; i < (it); i++) {
    long long x = randLL() % (n - 1) + 1;
    if (gcd(x, n) != 1) return 0;
    if (powi(x, n - 1, n) != 1) return 0;
  }
  return 1;
}
bool Check(long long a, long long b) {
  bool d1 = a * 1.0 >= (b * 1.0) * (b * 1.0 + 1) * 3;
  bool d2 = a >= b * (b + 1) * 3;
  return !(a * 1.0 >= (b * 1.0) * (b * 1.0 + 1) * 3 && a >= b * (b + 1) * 3);
}
int main() {
  ios::sync_with_stdio(false);
  long long n;
  cin >> n;
  long long l = 0, r = 1e13;
  while (l != r - 1) {
    long long m = (l + r) / 2;
    if (Check(n, m))
      r = m;
    else
      l = m;
  }
  r = l;
  n -= r * (r + 1) * 3;
  long long x = 2 * r;
  r++;
  long long y = 0;
  y += 2 * min(n, 1LL);
  x += 1 * min(n, 1LL);
  n -= 1 * min(n, 1LL);
  y += 2 * min(n, r - 1);
  x -= min(n, r - 1);
  n -= min(n, r - 1);
  x -= 2 * min(n, r);
  n -= min(n, r);
  y -= 2 * min(n, r);
  x -= min(n, r);
  n -= min(n, r);
  y -= 2 * min(n, r);
  x += min(n, r);
  n -= min(n, r);
  x += 2 * min(n, r);
  n -= min(n, r);
  y += 2 * min(n, r);
  x += min(n, r);
  n -= min(n, r);
  cout << x << " " << y << endl;
  pause();
  return 0;
}
