#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include <malloc.h>
int
main()
{
char
a[110],b[10];
int
c[10];
while
(
gets
(a)!=NULL)
{
memset
(b,0,
sizeof
(b));
memset
(c,0,
sizeof
(c));
int
i,j,k=0,flag=0,sum=0;
int
len=
strlen
(a);
if
(len>15||len<7) {
printf
(
"NO\n"
);
continue
;}
for
(i=0;i<len;i++)
{
if
((a[i]<
'0'
||a[i]>
'9'
)&&a[i]!=
'.'
)
{flag=1;
break
;}
if
(a[i]==
'.'
) b[k++]=i;
}
if
(flag==1) {
printf
(
"NO\n"
);
continue
;}
if
(k!=3) {
printf
(
"NO\n"
);
continue
;}
b[3]=len;
if
(b[0]==0||b[0]>3) {
printf
(
"NO\n"
);
continue
;}
else
{
for
(i=1;i<4;i++)
{
if
((b[i]-b[i-1])>4||(b[i]-b[i-1]<2))
{flag=1;
break
;}
}
}
if
(flag==1) {
printf
(
"NO\n"
);
continue
;}
for
(i=0;i<4;i++)
{
int
m=0;
for
(j=b[i]-1;a[j]!=
'.'
&&j>=0;j--)
c[i]+=((a[j]-
'0'
)*
pow
(10,m++));
if
(c[i]<0||c[i]>255) {flag=1;
break
;}
}
if
(flag==1)
printf
(
"NO\n"
);
else
printf
(
"YES\n"
);
}
}