while True:

try:
    ip_str = input().split('.')
    if len(ip_str) != 4:
        print('NO')
    else:
        for each in ip_str:
            if len(each) == 0:
                print('NO')
                break
            elif each.startswith('0') and len(each) != 1:
                print('NO')
                break
            elif not each.isdecimal():
                print('NO')
                break
            elif int(each) > 255 or int(each) < 0:
                print('NO')
                break

        else:
            print('YES')
    
except:
    break