#include <bits/stdc++.h>
using namespace std;
int n;
char c;
vector<int> f, l;
int main() {
  cin >> n;
  if (n == 1) {
    cin >> n;
    if (n / 10 != n % 10)
      cout << "YES";
    else
      cout << "NO";
    return 0;
  }
  for (int i = 0; i < n; i++) {
    cin >> c;
    f.push_back(c - '0');
  }
  for (int i = 0; i < n; i++) {
    cin >> c;
    l.push_back(c - '0');
  }
  sort(f.begin(), f.end());
  sort(l.begin(), l.end());
  if (f[0] < l[0]) {
    for (int i = 1; i < n; i++) {
      if (f[i] >= l[i]) {
        cout << "NO";
        return 0;
      }
    }
    cout << "YES";
  } else if (f[0] > l[0]) {
    for (int i = 1; i < n; i++) {
      if (f[i] <= l[i]) {
        cout << "NO";
        return 0;
      }
    }
    cout << "YES";
  } else
    cout << "NO";
  return 0;
}
