package me.yukicoder.lv1; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; public class No0138 { public static void main(String[] args) { try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) { String[] s1 = br.readLine().split("\\."); String[] s2 = br.readLine().split("\\."); int[][] v = new int[2][3]; for (int i = 0; i < s1.length; i++) { v[0][i] = Integer.parseInt(s1[i]); v[1][i] = Integer.parseInt(s2[i]); } for (int j = 0; j < 3; j++) { if (v[0][j] > v[1][j]) { System.out.println("YES"); break; } else if (v[0][j] < v[1][j]) { System.out.println("NO"); break; } else if (j == 2 && v[0][j] == v[1][j]) { System.out.println("YES"); } } } catch (IOException e) { e.printStackTrace(); } } }