import java.util.*;
public class Main {
        public static void main(String[] args){
            Scanner sc = new Scanner(System.in);
            while(sc.hasNext()){
                String str = sc.nextLine();
                String[] srr = str.split("\\.");
                boolean flag=true;
                for(String s : srr){
                    int temp = Integer.parseInt(s);
                    if(temp>=0 && temp<=255){
                        continue;
                    }else{
                        flag=false;
                        System.out.println("NO");
                        break;//遇到不合法的直接 打印break
                    }
                }
                if(flag){
                    //整个for循环结束后,都仍然是合法的,则输出yes
                    System.out.println("YES");
                }
            }
        }
}