Python 3 (Python 3.7.3)
from sys import stdin
for line in stdin:
n = int(line)
if n == 42:
break
print(n)
Doubtful Deer
from sys import stdin
for line in stdin:
n = int(line)
if n == 42:
break
print(n)