#include using namespace std; int main(){ int A0,B0,C0,A1,B1,C1; char gav; cin>>A0>>gav>>B0>>gav>>C0; cin>>A1>>gav>>B1>>gav>>C1; if(A0>A1||(A0==A1&&B0>B1)||(A0==A1&&B0==B1&&C0>=C1)) cout<<"YES"<