while True:
    try:
        s=input().split('.')
        l=''
        if len(s)==4:       
            for a in s:
                if a.isdigit() and (str(int(a))==a):
                    l=bin(int(a))[2:]
                    if len(l)>8:
                        print('NO')
                        break
                else:
                    print('NO')
                    break
            else:
                print('YES')
        else:
            print('NO')
    except:
        break