Y, M, D = map(int ,input().split()) print(['No', 'Yes'][19890107 < Y*10000 + M*100 + D < 20190430])