#include <bits/stdc++.h>
using namespace std;
int nr = 0;
char ch;
int citeste() {
  while ((ch = getchar()) && ch >= '0' && ch <= '9')
    nr = (nr << 1) + (nr << 3) + (ch - '0');
  return nr;
}
int main() {
  int n = citeste();
  int v1[n], v2[n], i;
  int c, prev;
  bool afs = false, ot = true;
  for (i = 0; i < n; i++) {
    ch = getchar();
    v1[i] = ch - '0';
  }
  for (i = 0; i < n; i++) {
    ch = getchar();
    v2[i] = ch - '0';
  }
  sort(v1, v1 + n);
  sort(v2, v2 + n);
  if (v1[0] < v2[0])
    c = 1;
  else if (v1[0] > v2[0])
    c = 2;
  else
    c = 3;
  prev = c;
  if (n == 1 && c == 3)
    cout << "NO";
  else if (n == 1 && c != 3)
    cout << "YES";
  else {
    for (i = 1; i < n; i++) {
      if (v1[i] < v2[i])
        c = 1;
      else if (v1[i] > v2[i])
        c = 2;
      else
        c = 3;
      if (c != 3) ot = false;
      if (prev != c) {
        cout << "NO";
        afs = true;
        break;
      }
      prev = c;
    }
    if (ot && !afs)
      cout << "NO";
    else if (!afs)
      cout << "YES";
  }
  return 0;
}
