We call a 4-digit integer with three or more consecutive same digits, such as 1118, **good**.  You are given a 4-digit integer N. Answer the question: Is N **good**?
n = input()
if len(set(n)) >= 3:
  print('Yes')
else:
  print('No')
s = input()
if len(set(s[1:])) == 1 or len(set(s[:3])) == 1:
  print('Yes')
else:
  print('No')