//容易遗漏的点在于数字串中有非法字符或字符'0'后跟字符的情况
//还有就是IP只有三个

#include <iostream>
#include <sstream>
#include <string>
#include <deque>
using namespace std;

int main() {
    string inputstr;
    cin >> inputstr;
    inputstr += ".";
    string tmp;
    int count = 0;
    for (int i = 0; i < inputstr.size(); ++i) {

        if (tmp == "" && ((!isdigit(inputstr[i])) || (inputstr[i] == '0' &&
                          inputstr[i + 1] != '.'))) {
            cout << "NO" << endl;
            return 0;
        }
        if (inputstr[i] == '.') {
            if (stoi(tmp) <= 255 && stoi(tmp) >= 0) {
                tmp = "";
                ++count;
                continue;
            } else {
                cout << "NO" << endl;
                return 0;
            }
        }
        tmp += inputstr[i];
    }
    if (count == 4)cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}