using System;
using System.Collections.Generic;

namespace HuaWeiTest
{
    class Pongam
    {
        static void Main(string[] arge)
        {
            string CF = "";

            while ((CF = Console.ReadLine()) != null)
            {


                //string IP1 = Console.ReadLine();
                //string kong = ".";

                //string IP = IP1 + kong + IP2 + kong + IP3 + kong + IP4 + kong + IP5;


                var ipshort = CF.Split('.');

                //string[] or = new string[1];
                int s = 0;

                foreach (var i in ipshort )
                {
                    
                    if( int.Parse(i) <= 255 && int.Parse(i)>= 0 && s < 3)
                    {
                        s++;
                    }
                    else if (s == 3 && int.Parse(i) >= 0 &&  int.Parse(i) <= 255 )
                    {
                        Console.WriteLine("YES");
                    }
                    else
                    {
                        Console.WriteLine("NO");
                        break;
                    }
                   
                }

            }

        }
    }
}