k = int(input())
p = int(input())
t = int(input())
for i in range(k, p + 1):
if i % 10 == t:
print(i, end = " ")
k = int(input())
p = int(input())
t = int(input())
for i in range(k, p + 1):
if i % 10 == t:
print(i, end = " ")