#include <iostream>
#include <string>
using namespace std;
int main()
{
string s, x;
cin >> s;
s += ' ';
int y = 0, temp = 0, temp2 = 0, null=0;
for (auto c : s) {
if (c >= '0' && c <= '9')
{
if (c == '0' && null == 1)
{
cout << "NO";
return 0;
}
if (c=='0')
{
null++;
}
x += c;
temp2++;
}
else if (c == '.' && temp < 3 && temp2 >= 1)
{
y = stoi(x);
if (y < 0 || y>255)
{
cout << "NO";
return 0;
}
temp2 = 0;
temp++;
y = 0;
null = 0;
x.clear();
}
else if (temp == 3 && c == ' ' && temp2 >= 1)
{
y = stoi(x);
if (y >= 0 && y <= 255)
{
cout << "YES";
}
else
{
cout << "NO";
return 0;
}
}
else
{
cout << "NO";
return 0;
}
}
return 0;
}