/* No.138 化石のバージョン https://yukicoder.me/problems/no/138 */ #include using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); // A.B.C string first, second; cin >> first; cin >> second; if (first == second) { cout << "YES" << endl; return 0; } else { if (first[0] > second[0]) { cout << "YES" << endl; return 0; } else if (first[0] < second[0]) { cout << "NO" << endl; return 0; } else { // A is same if (first[2] > second[2]) { cout << "YES" << endl; return 0; } else if (first[2] > second[2]) { cout << "NO" << endl; return 0; } else { // B is same if (first[4] > second[4]) { cout << "YES" << endl; return 0; } else if (first[4] > second[4]) { cout << "NO" << endl; return 0; } else { // C is same } } } } return 0; }