#拆分4段,转整数判断范围
# import sys
while True:
    try:
        ips = input().strip()
        iplist = ips.split('.')
        res = "YES"
        for s in iplist:
            if int(s) > 255 or int(s) < 0:
                res = "NO"
        print(res)

    except:
#         print(sys.exc_info())
        break