N=eval(input())

answer="No"

for i in range(len(N)-2):

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

    if N[i+1]==N[i+2]:

      answer="Yes"

print(answer)
N=eval(input())

print(("Yes" if (N[0]==N[1]==N[2])or(N[1]==N[2]==N[3]) else "No" ))
N = eval(input())
answer = "No"
for i in range(len(N) - 2):
    if N[i] == N[i + 1]:
        if N[i + 1] == N[i + 2]:
            answer = "Yes"
print(answer)

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

-answer = "No" -for i in range(len(N) - 2): -    if N[i] == N[i + 1]: -        if N[i + 1] == N[i + 2]: -            answer = "Yes" -print(answer) +print(("Yes" if (N[0] == N[1] == N[2]) or (N[1] == N[2] == N[3]) else "No"))