#2022/5/19 10:31
y,***p(int,input().split())
y1,m1,d1=map(int,input().split())
#不同年:查询年份y1>计划年份y, yes
#同年不同月:查询月份m1>计划月份m,yes
#同年同月不同日:查询日d1>计划日d,yes
if y1>y or (y1==y and m1>m) or (y1==y and m1==m and d1>=d):
    print("yes")
else:
    print("no")