x=int(input())
def hanoi(x,a,b,c):
     if x > 19:
          None
     elif x == 1:
          print('{} {}'.format(a,c))
     elif 19>=x>1:
          hanoi(x-1,a,c,b)
          print('{} {}'.format(a,c))
          hanoi(x-1,b,a,c)
print(2**x-1)
hanoi(x,1,2,3)


https://www.acmicpc.net/problem/1914


백준에다 넣고 돌리는데 [뇌코딩]으로는 '맞았습니다!!'가 계속뜨는데 우리 기계쿤은 그렇게 말하지 않네요.. ㅠㅠ 한번만 도와주십쇼