while True:
try:
s = input().split('.')
result = 'YES'
if len(s) != 4:
print('NO')
else:
for i in s:
if not i.isdigit() or (i.startswith('0') and len(i) > 1):
result = 'NO'
continue
if i.startswith('+'):
result = 'NO'
continue
if int(i) < 0 or int(i) > 255:
result = 'NO'
continue
print(result)
except:
break