#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  char x;
  cin >> n;
  vector<int> mario;
  vector<int> mario2;
  for (int i = 0; i < n; i++) {
    cin >> x;
    mario.push_back(x - '0');
  }
  for (int i = 0; i < n; i++) {
    cin >> x;
    mario2.push_back(x - '0');
  }
  sort(mario.begin(), mario.end());
  sort(mario2.begin(), mario2.end());
  int c1 = 1;
  int c2 = 1;
  for (int i = 0; i < n; i++) {
    if (mario[i] <= mario2[i]) {
      c1 = 0;
      break;
    }
  }
  for (int i = 0; i < n; i++) {
    if (mario2[i] <= mario[i]) {
      c2 = 0;
      break;
    }
  }
  if (c1 != 0 || c2 != 0) {
    cout << "YES";
  } else {
    cout << "NO";
  }
  return 0;
}
