//这题不难,就是格式很令人爆炸,比如01这种不算正确,..这种也要考虑
#include<stdio.h>
#include<string.h>

int main(void)
{
    char str[100]={0};
    int flag=0;
    int flag2=0;
    while(scanf("%s",&str)!=EOF)
    {
        int len=strlen(str);
        int a=0;
        for(int i=0;i<len;i++)
        {
            int temp;
            if(str[i]!='.')
            {
                temp=(str[i]-'0');
                a=a*10+temp;
            }
            if(str[i]=='0'&&(str[i+1]>'0'&&str[i+1]<'9'))
            {
                flag--;
                if(str[i-1]>'0'&&str[i-1]<'9')
                {
                    flag++;
                }
            }
            if(str[i]=='.'||i==(len-1))
            {
                if(str[i]=='.'&&i==0)
                {
                    flag--;
                }
                if(str[i]=='.'&&i>=1&&str[i-1]=='.')
                {
                    flag--;
                }
                if(a>=0&&a<=255&&i!=0)
                {
                    flag++;
                }
                a=0;
            }
        }
        //printf("%d\n",flag);
        if(flag==4)
        {
            printf("YES");
        }
        else
        {
            printf("NO");
        }
    }
    return 0;
}