#include <bits/stdc++.h>
using namespace std;
long long int vowel(char a) {
  a = toupper(a);
  if ((a == 'A') || (a == 'E') || (a == 'I') || (a == 'O') || (a == 'U')) {
    return 1;
  }
  return 0;
}
long long int bigMod(long long int a, long long int b, long long int c) {
  if (b == 0) {
    return 1 % c;
  }
  long long int x = bigMod(a, b / 2, c);
  x = (x * x) % c;
  if (b % 2 == 1) {
    x = (x * a) % c;
  }
  return x;
}
long long int p[1100002];
vector<long long int> prime;
void sieve() {
  long long int N = 1100002, sq = sqrt(N), i, j;
  for (i = 4; i <= N; i += 2) {
    p[i] = 1;
  }
  for (i = 3; i <= sq; i += 2) {
    if (p[i] == 0) {
      for (j = i * i; j <= N; j += i) {
        p[j] = 1;
      }
    }
  }
  p[1] = 1;
  p[0] = 1;
  prime.push_back(2);
  prime.push_back(3);
  for (i = 4; i <= N; i += 2) {
    if (p[i] == 0) {
      prime.push_back(i);
    }
  }
}
long long int ar[123456];
vector<long long int> v1, v2;
string s;
map<long long int, long long int> mp;
map<long long int, long long int> mpf;
map<string, long long int> mps;
map<char, long long int> mpc;
int main() {
  long long int i, n;
  cin >> n;
  for (i = 1; i <= n; i++) {
    char c;
    cin >> c;
    c -= 48;
    v1.push_back((int)c);
  }
  for (i = 1; i <= n; i++) {
    char c;
    cin >> c;
    c -= 48;
    v2.push_back((int)c);
  }
  long long int c1 = 0, c2 = 0;
  sort((v1).begin(), (v1).end());
  sort((v2).begin(), (v2).end());
  for (i = 0; i < n; i++) {
    if (v1[i] < v2[i]) c1++;
    if (v1[i] > v2[i]) c2++;
  }
  if (c1 == n || c2 == n)
    printf("YES\n");
  else
    printf("NO\n");
}
