#include using namespace std; int main() { long A[3]; long a; long B[3]; long b; char token; cin >> A[0] >> token >> A[1] >> token >> A[2]; cin >> B[0] >> token >> B[1] >> token >> B[2]; a = A[0] * 1000000 + A[1] * 1000 + A[2]; b = B[0] * 1000000 + B[1] * 1000 + B[2]; if (a < b) { cout << "NO" << endl; } else { cout << "YES" << endl; } return 0; }