#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
using namespace std;
const long long N = 1e5 + 5;
long long dx[] = {1, -1, -2, -1, 1, 2};
long long dy[] = {2, 2, 0, -2, -2, 0};
long long cnt[] = {1, 0, 1, 1, 1, 1};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n;
  cin >> n;
  long long ans = 0, s = 0, e = 1e9;
  while (s <= e) {
    long long mid = (s + e) >> 1;
    if (3 * mid * mid + 2 * mid <= n)
      ans = max(ans, mid), s = mid + 1;
    else
      e = mid - 1;
  }
  long long x = ans, y = -2 * ans;
  for (long long i = 0; i < 6; i++) cnt[i] += ans;
  ans = 3 * ans * ans + 2 * ans;
  for (long long j = 0; ans < n; j = (j + 1) % 6) {
    long long mv = min(cnt[j], n - ans);
    ans += mv;
    x += dx[j] * mv;
    y += dy[j] * mv;
    cnt[j]++;
  }
  cout << x << " " << y;
}
