y, m, d = map(int, input().split()) x = 10000*y + 100*m + d print(['No', 'Yes'][19890107 < x < 20190501])