while True:
try:
nums = input().split('.')
if len(nums) != 4:
print('NO')
continue
count = 0
for n in nums:
if not n.isdigit():
print('NO')
break
else:
if int(n) > 255:
print('NO')
break
else:
count += 1
if count == 4:
print('YES')
except:
break