#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a = 0, b = 0;
  char *p = new char[n + 1];
  char *q = new char[n + 1];
  for (int i = 0; i < n; i++) cin >> p[i];
  for (int i = 0; i < n; i++) cin >> q[i];
  p[n] = '\0';
  q[n] = '\0';
  sort(p, p + n);
  sort(q, q + n);
  for (int i = 0; i < n; i++) {
    if (p[i] > q[i])
      a = 1;
    else if (p[i] < q[i])
      b = 1;
    else {
      a = 1;
      b = 1;
    }
    if (a == 1 && b == 1) break;
  }
  if (a ^ b)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
