#include <bits/stdc++.h>
using namespace std;
const int MaxN = 300;
int n;
int a[MaxN], b[MaxN];
int main() {
  cin.sync_with_stdio(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    char c;
    cin >> c;
    a[i] = c - '0';
  }
  for (int i = 0; i < n; i++) {
    char c;
    cin >> c;
    b[i] = c - '0';
  }
  sort(a, a + n);
  sort(b, b + n);
  bool found = true;
  for (int i = 0; i < n; i++)
    if (a[i] >= b[i]) found = false;
  if (found) {
    puts("YES");
    return 0;
  }
  found = true;
  for (int i = 0; i < n; i++)
    if (b[i] >= a[i]) found = false;
  if (found) {
    puts("YES");
    return 0;
  }
  puts("NO");
  return 0;
}
