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

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

    print("Yes")

else:

    print("No")
n = int(eval(input()))

n = str(n)

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

    print("Yes")

else:

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

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

-n = list(map(int, eval(input()))) +n = int(eval(input())) +n = str(n)