#include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
int sum = 0;
for (int i = 1; i < 100000; i++)
{
sum += i;
if ((sum - n) % 3 != 0)
continue;
int x = (sum - n) / 3;
if (x <= i && x >= 1)
{
cout << x << " " << i;
break;
}
}
return 0;
}