import strutils, sequtils, math proc judge(a, b: openArray[int]; depth: int): string = if depth == 3: return "YES" if a[depth] > b[depth]: return "YES" elif a[depth] < b[depth]: return "NO" else: return judge(a, b, depth + 1) var a_seq = split(readLine(stdin), '.').mapIt(int, it.parseInt) b_seq = split(readLine(stdin), '.').mapIt(int, it.parseInt) echo(judge(a_seq, b_seq, 0))