a = list(map(int,list(eval(input()))))

count = 1

check = False

for i in range(len(a)-1):

    if a[i] == a[i+1]:

        count += 1

        if count==3:

            check = True

    else:

        count = 1

print(('Yes' if check==True else 'No'))
a = list(map(int,list(eval(input()))))

check = False

if a[0] == a[1] == a[2] or a[1]==a[2]==a[3]:

    check = True



print(('Yes' if check==True else 'No'))
a = list(map(int, list(eval(input()))))
count = 1
check = False
for i in range(len(a) - 1):
    if a[i] == a[i + 1]:
        count += 1
        if count == 3:
            check = True
    else:
        count = 1
print(("Yes" if check == True else "No"))

a = list(map(int, list(eval(input()))))
check = False
if a[0] == a[1] == a[2] or a[1] == a[2] == a[3]:
    check = True
print(("Yes" if check == True else "No"))

-count = 1 -for i in range(len(a) - 1): -    if a[i] == a[i + 1]: -        count += 1 -        if count == 3: -            check = True -    else: -        count = 1 +if a[0] == a[1] == a[2] or a[1] == a[2] == a[3]: +    check = True