import java.io.; public class Main{ public static void main(String[]args)throws IOException{ BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String str = null; while((str = in.readLine()) != null){ // System.out.println(str); String[] arr = str.split("\."); // System.out.println(arr.length); if(arr.length != 4){ System.out.println("NO"); continue; } int flag = 0; for(int i = 0;i < 4;i ++){ if(arr[i].matches("^0|[1-9][0-9]$")){ if(Integer.parseInt(arr[i]) > 255 || Integer.parseInt(arr[i]) < 0){ flag = 1; break; } }else{ flag = 1; break; } } if(flag == 1){ System.out.println("NO"); }else{ System.out.println("YES"); } } } }