#include <bits/stdc++.h>
using namespace std;
const int DX[8] = {1, -1, 0, 0, 1, 1, -1, -1};
const int DY[8] = {0, 0, 1, -1, 1, -1, 1, -1};
const int intmax = 0x7fffffff;
vector<pair<int, int> > f;
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < 2 * n; i++) {
    int a;
    scanf("%1d", &a);
    f.push_back(make_pair(a, i / n));
  }
  sort(f.begin(), f.end());
  bool vis[205] = {0};
  for (int i = 1; i < 2 * n; i++) {
    if (f[i].second == f[0].second)
      continue;
    else {
      int flag = 0;
      for (int j = 0; j < i; j++) {
        if (vis[j]) continue;
        if (f[i].second == f[j].second) continue;
        if (f[i].first > f[j].first) {
          flag = 1;
          vis[j] = 1;
          break;
        }
      }
      if (!flag) return puts("NO") & 0;
    }
  }
  puts("YES");
}
