while True:
try:
flag = 0
a = input().split('.') #用.分开
if(len(a) != 4): #若长度不为4,则非法
print('NO')
continue
for i in range(4):
if(a[i].isdigit() == False): #若不是数字,则非法
print('NO')
flag = 1
break
if(len(a[i]) > 1):
if(a[i][0] == '0'): #011这种形式非法
print('NO')
flag = 1
break
if(int(a[i]) > 255) or (int(a[i]) < 0): #不在0-255之间则非法
print('NO')
flag = 1
break
if(flag == 0):
print('YES')
except:
break