inp = int(input()) split_first = first.split() Y, M, D = map(int, input().split()) def hantei(Y,M,D): if (1989<=Y and 1<=M and 8<=D) and (Y<=2019 and M<=4 and D<=30): print('Yes') else: print('No') hantei(Y,M,D)