#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int l[100], r[100];
  char c;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> c;
    l[i] = c - 48;
  }
  for (int i = 0; i < n; i++) {
    cin >> c;
    r[i] = c - 48;
  }
  bool t;
  int temp;
  while (true) {
    t = true;
    for (int i = 0; i < n - 1; i++) {
      if (l[i] > l[i + 1]) {
        t = false;
        temp = l[i];
        l[i] = l[i + 1];
        l[i + 1] = temp;
      }
    }
    if (t) break;
  }
  while (true) {
    t = true;
    for (int i = 0; i < n - 1; i++) {
      if (r[i] > r[i + 1]) {
        t = false;
        temp = r[i];
        r[i] = r[i + 1];
        r[i + 1] = temp;
      }
    }
    if (t) break;
  }
  t = true;
  for (int i = 0; i < n - 1; i++) {
    if ((r[i] - l[i]) * (r[i + 1] - l[i + 1]) <= 0) {
      t = false;
      break;
    }
  }
  if ((n = 1) && (l[0] == r[0])) t = false;
  if (t)
    cout << "YES";
  else
    cout << "NO";
}
