#include using namespace std; int main(void) { int a1, b1, c1, a2, b2, c2; char c; cin >> a1 >> c >> b1 >> c >> c1 >> a2 >> c >> b2 >> c >> c2; bool ok = true; if (a1 < a2) ok = false; else if (a1 == a2) { if (b1 < b2) ok = false; else if (b1 == b2) { if (c1 < c2) ok = false; } } cout << (ok ? "YES" : "NO") << endl; return 0; }