#include <bits/stdc++.h>
using namespace std;
const int N = 111111;
const int INF = int(1e9), mod = (int)1e9 + 7;
int n, f, s;
char fhalf[N], shalf[N];
int main() {
  cin >> n;
  for (int(i) = (0); (i) < (n); ++(i)) cin >> fhalf[i];
  for (int(i) = (0); (i) < (n); ++(i)) cin >> shalf[i];
  sort(fhalf, fhalf + n);
  sort(shalf, shalf + n);
  for (int(i) = (0); (i) < (n); ++(i)) {
    if (fhalf[i] > shalf[i]) ++f;
    if (fhalf[i] < shalf[i]) ++s;
  }
  if (f == n || s == n) {
    puts("YES");
  } else {
    puts("NO");
  }
  return 0;
}
