while True: try: ip_list = input().split(".") ind = 0 if not len(ip_list) == 4: #如果长度不是4,不是ip print("NO") continue for i in ip_list: if not i.isdigit():#如果不是数字,不是ip print("NO") continue elif not 0 <= int(i) <= 255 or (i.startswith("0") and len(i) > 1):#如果数字不是在0-255范围内 #如果数字大于1但是开头是0,不是ip print("NO") continue else: ind += 1 if ind == 4: #如果4个都是合法的 print("YES") except: break