#include <bits/stdc++.h>
using namespace std;
int n, i, v[110], w[110], ok = 0;
char c;
int main() {
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> c;
    v[i] = (int)c - 48;
  }
  for (i = 1; i <= n; i++) {
    cin >> c;
    w[i] = (int)c - 48;
  }
  sort(v + 1, v + 1 + n);
  sort(w + 1, w + 1 + n);
  if (v[1] - w[1] != 0) {
    ok = 1;
    if (v[1] - w[1] > 0) {
      for (i = 2; i <= n && ok; i++)
        if (v[i] - w[i] <= 0) ok = 0;
    } else {
      for (i = 2; i <= n && ok; i++)
        if (v[i] - w[i] >= 0) ok = 0;
    }
  }
  if (ok)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
