y, m, d = map(int, input().split()) date = y * 10000 + m * 100 + d print(['Yes','No'][0 if 19890108 <= date <= 20190430 else 1])