
#include <cctype>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
vector<int> splitByPoint(string str) {
vector<int> res;
string temp;
for (int i = 0; i <= str.size(); ++i) {
if (str[0] == '.') {
return res;
}
if (str[i] == '.' || i == str.size()) {
if (!temp.empty()) {
if (temp.size() > 1 && (temp[0] == '0' || !isdigit(temp[0])))
return res;
res.emplace_back(stoi(temp));
temp.clear();
}
else {
return res;
}
}
else {
temp.push_back(str[i]);
}
}
return res;
}
bool is0To255(int value) {
return value >= 0 && value <= 255;
}
int main() {
string str;
getline(cin, str);
vector<int> res = splitByPoint(str);
if (res.size() == 4) {
if (is0To255(res[0]) && is0To255(res[1]) && is0To255(res[2]) && is0To255(res[3])) {
cout << "YES" << endl;
return 0;
}
}
cout << "NO" << endl;
return 0;
}