#The solution in Python 3 is as follows:
n=int(input())
while n!=42:
print(n)
n=int(input())
#Keep visiting for more solutions of SPOJ problems in Python 3.Thank you!!!
n=int(input())
while n!=42:
print(n)
n=int(input())
#Keep visiting for more solutions of SPOJ problems in Python 3.Thank you!!!