'''
解题思路:
合法IP条件:有4位数,介于0-255之间
'''
while 1:
    try:
        pass

        L = list(map(int,input().strip().split('.')))
        out = 'YES'
        if len(L) != 4:
            out = 'NO'
        for x in L:
            if x<0 or x>255:
                out = 'NO'
        print(out)

    except:
        break