x = input().strip().split()
y= input()
charlist = list(x)
print(charlist)
print(charlist[:-1])
charlist[-1] = y
print(charlist)