#include <bits/stdc++.h>
using namespace std;
int n;
bool cmp(char c1, char c2) { return c1 > c2; }
int main() {
  cin >> n;
  char *c1 = new char[n];
  char *c2 = new char[n];
  for (int i = 0; i < n; i++) cin >> c1[i];
  for (int i = 0; i < n; i++) cin >> c2[i];
  int flag1 = 1;
  int flag2 = 1;
  sort(c1, c1 + n, cmp);
  sort(c2, c2 + n, cmp);
  for (int i = 0; i < n; i++) {
    if (c1[i] > c2[i])
      continue;
    else {
      flag1 = 0;
      break;
    }
  }
  for (int i = 0; i < n; i++) {
    if (c1[i] < c2[i])
      continue;
    else {
      flag2 = 0;
      break;
    }
  }
  if (flag1 == 1 || flag2 == 1)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
