import java.io.*;
import java.util.*;

public class Main{
    public static void main(String[] args) throws Exception{
        Scanner sc = new Scanner(System.in);

        while(sc.hasNextLine()){
            String line = sc.nextLine();
            String[] ss = line.split("\\.");//注意regex中是\\.而不是.
            boolean flag = true;
            for(int i = 0; i < ss.length; ++i){
                int a = Integer.parseInt(ss[i]);
                if(a < 0 || a > 255){
                    flag = false;
                    System.out.println("NO");
                    break;
                }
            }
            if(flag){
                System.out.println("YES");
            }
        }

    }
}