a,b,c,d = eval(input())

if a==b and b==c:

    print('Yes')

elif b==c and c==d:

    print('Yes')

else:

    print('No')
a,b,c,d = eval(input())

print(('Yes' if a==b==c or b==c==d else 'No'))
a, b, c, d = eval(input())
if a == b and b == c:
    print("Yes")
elif b == c and c == d:
    print("Yes")
else:
    print("No")

a, b, c, d = eval(input())
print(("Yes" if a == b == c or b == c == d else "No"))

-if a == b and b == c: -    print("Yes") -elif b == c and c == d: -    print("Yes") -else: -    print("No") +print(("Yes" if a == b == c or b == c == d else "No"))