import java.util.*; class Main { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { String[] a = sc.next().split("\\.",0); String[] b = sc.next().split("\\.",0); String ans = "NO"; for (int i=0; i<3; i++) { if (b[i].compareTo(a[i]) < 0) { ans = "YES"; break; } } System.out.println(ans); } }