import java.util.Scanner;
/**
* HJ90 合法IP
*/
public class HJ090 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (sc.hasNext()) {
String str = sc.nextLine();
String[] arr = str.split("\\.");
if (arr.length != 4) {
System.out.println("NO");
return;
}
for (String s : arr) {
try {
int n = Integer.parseInt(s);
if (n < 0 || n > 255) {
System.out.println("NO");
return;
}
if (s.length() > 1 && (s.startsWith("0") || s.startsWith("-") || s.startsWith("+"))) {
System.out.println("NO");
return;
}
} catch (NumberFormatException e) {
System.out.println("NO");
return;
}
}
System.out.println("YES");
}
sc.close();
}
}