#include <bits/stdc++.h>
using namespace std;
int comp(const void* a, const void* b) { return *(int*)b - *(int*)a; }
bool resa(int* a, int* b, int n) {
  for (int i = 0; i < n; ++i) {
    if (a[i] >= b[i]) {
      return false;
    }
  }
  return true;
}
int main() {
  int n;
  int a[100], b[100];
  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';
  }
  qsort(a, n, sizeof(int), comp);
  qsort(b, n, sizeof(int), comp);
  if (resa(a, b, n) || resa(b, a, n))
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
