while True:
    try:
        ip_lst = list(input().split("."))
        a = 0
        for i in ip_lst:
            if i.isdigit() and 0 <= int(i) <= 255 and len(str(i)) == len(str(int(i))):
                a += 1
        if a == 4:
            print("YES")
        else:
            print("NO")
    except:
        break