s = eval(input())



cnt = 1

prev = ''

for c in s:

    if prev == c:

        cnt += 1

    else:

        cnt = 1

    

    if cnt >= 3:

        print('Yes')

        exit()

    prev = c



print('No')
s = eval(input())

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

    print('Yes')

else:

    print('No')
s = eval(input())
cnt = 1
prev = ""
for c in s:
    if prev == c:
        cnt += 1
    else:
        cnt = 1
    if cnt >= 3:
        print("Yes")
        exit()
    prev = c
print("No")

s = eval(input())
if s[0] == s[1] == s[2] or s[1] == s[2] == s[3]:
    print("Yes")
else:
    print("No")

-cnt = 1 -prev = "" -for c in s: -    if prev == c: -        cnt += 1 -    else: -        cnt = 1 -    if cnt >= 3: -        print("Yes") -        exit() -    prev = c -print("No") +if s[0] == s[1] == s[2] or s[1] == s[2] == s[3]: +    print("Yes") +else: +    print("No")