# coding: utf-8 # yukicoder No.138 化石のバージョン ver_fossil = [int(i) for i in input().split(".")] ver_j = [int(i) for i in input().split(".")] print("YES" if ver_j <= ver_fossil else "NO")