import java.util.Scanner;
// 1. 初始 字符串分割之后,一定要分成 4 部分,否则直接返回
// 2. 分割后的字符串不能为 空串,否则直接返回
// 3. 分割后的字符串不能包含 除数字以外 的任何字符(即在 IPv4 中,对于每一部分的数字,都不能 大于255 或者为 负数)
// 4. 别忘了,对于每一部分,不能有 前导0,即不能有 255.002.255.12 这种情况
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
String s = in.next();
String[] arr = s.split("\\.");
String res = "YES";
// System.out.print(arr.length);
int[] num = new int[4];
if (arr.length != 4)res = "NO";
else {
for (int i = 0; i < 4; i++) {
if ("".equals(arr[i])) {
res = "NO";
break;
}
num[i] = Integer.valueOf(arr[i]);
if (num[i] < 0 || num[i] > 255)res = "NO";
else if (!Integer.toString(num[i]).equals(arr[i]))res = "NO";
}
}
System.out.print(res);
}
}