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