include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
bool f = true;
int day = 1;
int b;
while(n){
if(n % 3 != 0){
if(n % 3 == 1 && f){
b = day;
f = false;
}
n -= n / 3 + 1;
}else n -= n / 3;
day++;
}
cout << day - 1 << " " << b;
}