#include <bits/stdc++.h>
using namespace std;
char a[201];
int i, n, q, w;
int main() {
  cin >> n;
  for (i = 1; i <= 2 * n; i++) cin >> a[i];
  sort(a + 1, a + n + 1);
  sort(a + n + 1, a + n + n + 1);
  for (i = 1; i <= n; i++) {
    if (a[i] > a[i + n]) q++;
    if (a[i] < a[i + n]) w++;
  }
  if (q == n || w == n)
    cout << "YES";
  else
    cout << "NO";
}
