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 (a[i].compareTo(b[i]) == 1) { ans = "YES"; break; } } System.out.println(ans); } }