x = int(input())
pred = x % 10
x = x // 10
z = "Нет"
while x > 0:
if x % 10 == pred:
z = "Да"
x //= 10
print(z)
x = int(input())
pred = x % 10
x = x // 10
z = "Нет"
while x > 0:
if x % 10 == pred:
z = "Да"
pred = x % 10
x //= 10
print(z)