N = eval(input())

ans = 'No'

if (N[0]==N[1] or N[2]==N[3]) and N[1]==N[2]:

  ans = 'Yes'  

print(ans)
def check():

    S = list(eval(input()))

    if len(set(S[:-1]))==1 or len(set(S[1:]))==1:

        return 'Yes'

    return 'No'

print((check()))
N = eval(input())
ans = "No"
if (N[0] == N[1] or N[2] == N[3]) and N[1] == N[2]:
    ans = "Yes"
print(ans)

def check():
    S = list(eval(input()))
    if len(set(S[:-1])) == 1 or len(set(S[1:])) == 1:
        return "Yes"
    return "No"


print((check()))

-N = eval(input()) -ans = "No" -if (N[0] == N[1] or N[2] == N[3]) and N[1] == N[2]: -    ans = "Yes" -print(ans) +def check(): +    S = list(eval(input())) +    if len(set(S[:-1])) == 1 or len(set(S[1:])) == 1: +        return "Yes" +    return "No" + + +print((check()))