import java.util.Scanner; public class No138 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String[] kasekiVer = sc.next().split("\\."); String[] hanteiVer = sc.next().split("\\."); sc.close(); String kaseki = "NO"; for(int i = 2; i >= 0; i--){ if(Integer.valueOf(kasekiVer[i]) >= Integer.valueOf(hanteiVer[i])){ kaseki = "YES"; }else{ kaseki = "NO"; } } System.out.println(kaseki); } }