#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
using namespace std;
void HanoiTower(int num, int from, int by, int to)
{
if (num == 1) printf("%d %d\n", from, to);
else
{
HanoiTower(num - 1, from, to, by);
printf("%d %d \n", from, to);
HanoiTower(num - 1, by, from, to);
}
}
int main(void)
{
int N;
cin >> N;
string a = to_string(pow(2, N));
int x = a.find('.'); //pow 함수 결과가 실수형이기에 소수점 찾기
a = a.substr(0, x); //소수점 앞자리만 나오게하기
a[a.length() - 1] -= 1; //string a에 대한 마지막 위치의 인덱스 값에 -1
cout << a << endl;
if(N <= 20)
HanoiTower(N, 1, 2, 3);
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y3N0ZGlvPgojaW5jbHVkZSA8Y21hdGg+CiNpbmNsdWRlIDxzdHJpbmc+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKdm9pZCBIYW5vaVRvd2VyKGludCBudW0sIGludCBmcm9tLCBpbnQgYnksIGludCB0bykKewoJaWYgKG51bSA9PSAxKSBwcmludGYoIiVkICVkXG4iLCBmcm9tLCB0byk7CgllbHNlCgl7CgkJSGFub2lUb3dlcihudW0gLSAxLCBmcm9tLCB0bywgYnkpOwoJCXByaW50ZigiJWQgJWQgXG4iLCBmcm9tLCB0byk7CgkJSGFub2lUb3dlcihudW0gLSAxLCBieSwgZnJvbSwgdG8pOwoJfQp9CgppbnQgbWFpbih2b2lkKQp7CglpbnQgTjsKCWNpbiA+PiBOOwoKCXN0cmluZyBhID0gdG9fc3RyaW5nKHBvdygyLCBOKSk7CgkKCWludCB4ID0gYS5maW5kKCcuJyk7CQkJCS8vcG93IO2VqOyImCDqsrDqs7zqsIAg7Iuk7IiY7ZiV7J206riw7JeQIOyGjOyImOygkCDssL7quLAKCWEgPSBhLnN1YnN0cigwLCB4KTsJCQkJLy/shozsiJjsoJAg7JWe7J6Q66as66eMIOuCmOyYpOqyjO2VmOq4sAoJYVthLmxlbmd0aCgpIC0gMV0gLT0gMTsJCQkJLy9zdHJpbmcgYeyXkCDrjIDtlZwg66eI7KeA66eJIOychOy5mOydmCDsnbjrjbHsiqQg6rCS7JeQIC0xCgoJY291dCA8PCBhIDw8IGVuZGw7CgoJaWYoTiA8PSAyMCkKCQlIYW5vaVRvd2VyKE4sIDEsIDIsIDMpOwoKCXJldHVybiAwOwp9