/* 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; int f[3] = { (int)first[0], (int)first[2], (int)first[4], }; int s[3] = { (int)second[0], (int)second[2], (int)second[4], }; if (first == second) { cout << "YES" << endl; } else { if (f[0] > s[0]) { cout << "YES" << endl; } else if (f[0] < s[0]) { cout << "NO" << endl; } else { // A is same if (f[1] > s[1]) { cout << "YES" << endl; } else if (f[1] < s[1]) { cout << "NO" << endl; } else { // B is same if (f[2] > s[2]) { cout << "YES" << endl; } else if (f[2] < s[2]) { cout << "NO" << endl; } else { // C is same } } } } return 0; }