#include <bits/stdc++.h>
using namespace std;
const int OO = (int)1e8;
const double EPS = 1e-11;
int diri[] = {0, 1, -1, 0};
int dirj[] = {1, 0, 0, -1};
int arr[101][102];
int ans[101];
map<char, string> m;
int main() {
  int n;
  cin >> n;
  vector<char> a(n), b(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i < n; ++i) cin >> b[i];
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  vector<bool> vis(n, 0);
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      if (b[j] <= a[i] || vis[j]) continue;
      vis[j] = 1;
      goto out;
    }
    goto tany;
  out:;
  }
  goto ok;
tany:;
  vis = vector<bool>(n, 0);
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      if (b[j] >= a[i] || vis[j]) continue;
      vis[j] = 1;
      goto out2;
    }
    cout << "NO";
    goto end;
  out2:;
  }
ok:;
  cout << "YES";
end:;
  return 0;
}
