#include <bits/stdc++.h>
using namespace std;
const long long MOD = (long long)1e9;
const int NMAX = (1e6) + 5;
const int INF = 1e7;
std::ifstream in("input.txt");
std::ofstream out("output.txt");
int main() {
  int n;
  cin >> n;
  char x;
  vector<char> v1, v2;
  for (int i = 0; i < 2 * n; i++) {
    cin >> x;
    if (i < n)
      v1.push_back(int(x));
    else
      v2.push_back(int(x));
  }
  sort(v1.begin(), v1.end());
  sort(v2.begin(), v2.end());
  int ans = 0, ans1 = 0;
  for (int i = 0; i < n; i++) {
    if (v1[i] < v2[i])
      ans++;
    else if (v1[i] > v2[i])
      ans1++;
  }
  if (ans == n || ans1 == n)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}
