while True:
try:
a = input().split('.')
b = 0
for i in a:
if i.isnumeric() == True and 0 <= int(i) <= 255:
if len(i) > 1 and i[0] == '0':
pass
else:
b += 1
if b == 4:
print('YES')
else:
print('NO')
except:
break