#include "bits/stdc++.h"
using namespace std;

#ifndef LOCAL
#define debug(...)
#endif

#define SZ(x) ((int) x.size())
#define int   long long
#define endl '\n'
#define pii   pair<int, int>

void test_case() 
{
    string a, b;
    cin >> a >> b;

    int n = SZ(a), m = SZ(b);

    if (SZ(a) < SZ(b)) swap(a, b);
    for (int i=n-m; i < n; i++) {
        if (a[i] < b[i - (n-m)]) {
            cout << "No" << endl;
            return;
        }
    }
    cout << "Yes" << endl;
}

signed main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int tc = 1;
    // cin >> tc;
    while (tc--) {
        test_case();
    }
}