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