import sys

stack = [1,2,3,4,5]
a=int(input())
stack.pop(len(stack)-1)
print(stack)
stack.pop(len(stack)-1)
print(stack)
stack.append(a)
print(stack)