import sys
for line in sys.stdin:
    line = line[:-1]
    line = line.split(".")
    if len(line) != 4:
        n = 0
    else:
        for i in line:
            if i.isdecimal() and len(i) == len(str(int(i))):#这里and后面为了排除数字前面加0的情况,比如01。
                if 0 > int(i) or int(i) > 255:
                    n = 0
                    break
                n = 1
            else:
                n = 0
                break
    if n :
        print("YES")
    else:
        print('NO')