import java.io.*; public class No446{ public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String a = br.readLine(); String b = br.readLine(); char[] A = a.toCharArray(); char[] B = b.toCharArray(); if(check(a, A) && check(b, B)) System.out.println("YES"); else System.out.println("NO"); } public static boolean check(String a, char[] A){ boolean c = false; int count = 0; for(int i=0; i < A.length; i++) if(Character.isDigit(A[i])) count++; if(count == A.length){ int num = Integer.parseInt(a); if(0 < num && num < 12345 ) c = true; } return c; } }