' '.join(map(str, mv[i]))
# 결과
```python
N = int(input())
mv = []
def f_mv(N,i0,i1):
mv.append([i0,i1])
return
st = [[i for i in range(1,N+1)],[],[]]
def f_hanoi(N,i0,i1,ii):
if N == 1:
f_mv(1, i0, i1)
else:
f_hanoi(N-1,i0,ii,i1)
f_mv(N,i0,i1)
f_hanoi(N-1,ii,i1,i0)
f_hanoi(N,1,3,2)
nn = len(mv)
print(nn)
for i in range(nn):
print(' '.join(map(str, mv[i])))