ip = input().split('.')
def f(x):
    if len(x) != 4:
        return False
    for i in x:
           if not i.isdigit():
                return False
           if int(i) > 255 or (i[0]=='0' and len(i)>1):
                return False
    return True

if f(ip):
   print('YES')
else:
    print('NO')