g=lambda:map(int,input().split('.')) *a,=g() *b,=g() print('YNEOS'[a