y, m, d = map(int, input().split()) print(['No', 'Yes'][19897) or (y==2019 and ((m==4 and d<=30) or m<4))])