#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, j;
  int a[200], b[200];
  char a1[200], b1[200];
  scanf("%d", &n);
  getchar();
  for (i = 1; i <= n; i++) {
    scanf("%c", &a1[i]);
    a[i] = (int)a1[i];
  }
  for (i = 1; i <= n; i++) {
    scanf("%c", &b1[i]);
    b[i] = (int)b1[i];
  }
  sort(a + 1, a + n + 1);
  sort(b + 1, b + n + 1);
  if (a[n] < b[n]) {
    for (i = 1; i < n; i++)
      if (a[i] >= b[i]) break;
    if (i < n)
      printf("NO\n");
    else
      printf("YES\n");
  } else if (a[n] == b[n])
    printf("NO\n");
  else {
    for (i = 1; i < n; i++) {
      if (a[i] <= b[i]) break;
    }
    if (i < n)
      printf("NO\n");
    else
      printf("YES\n");
  }
}
