import java.util.Scanner;
// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
// 注意 hasNext 和 hasNextLine 的区别
while (in.hasNext()) {
String ip = in.nextLine();
String[] split = ip.split("\\.");
if (getResult(split)) {
System.out.println("YES");
} else {
System.out.println("NO");
}
}
}
private static boolean getResult(String[] split) {
if (split.length != 4) {
return false;
}
for (int i = 0; i < split.length; i++) {
String s = split[i];
if (s == null || s.equals("")) {
return false;
}
for (int k = 0; k < s.length(); k++) {
if (!Character.isDigit(s.charAt(k))) {
return false;
}
}
int j = Integer.parseInt(s);
if (j < 0 || j > 255) {
return false;
}
// 注意排除001.002.003.004的类似情况
String substring = s.substring(0, 1);
if (substring.contains("0") && s.length() != 1) {
return false;
}
}
return true;
}
}