#include <bits/stdc++.h>   using namespace std;   const double pi = acos(-1.0);   template <typename T, typename U>   inline void amin(T &x, U y) {     if (y < x) x = y;   }   template <typename T, typename U>   inline void amax(T &x, U y) {     if (x < y) x = y;   }   template <class L, class R>   ostream &operator<<(ostream &os, pair<L, R> P) {     return os <<  (  << P.first <<  ,  << P.second <<  ) n ;   }   template <class T>   ostream &operator<<(ostream &os, set<T> V) {     os <<  [ ;     for (auto vv : V) os << vv <<  ,  ;     return os <<   b b] n ;   }   template <class T>   ostream &operator<<(ostream &os, vector<T> V) {     os <<  [ ;     for (auto vv : V) os << vv <<  ,  ;     return os <<   b b] n ;   }   template <class K, class X>   ostream &operator<<(ostream &os, map<K, X> V) {     os <<  [ ;     for (auto vv : V) os << vv <<  ,  ;     return os <<   b b] n ;   }   long int ceildiv(long int n, long int f) {     if (n % f) {       return n / f + 1;     } else       return n / f;   }   string checkTicket(vector<long> first, vector<long> second) {     int n = first.size();     if (first[0] < second[0]) {       for (int i = 0; i < n; i += 1) {         if (first[i] >= second[i]) {           return  NO n ;         }       }     } else if (first[0] > second[0]) {       for (int i = 0; i < n; i += 1) {         if (first[i] <= second[i]) {           return  NO n ;         }       }     } else {       return  NO n ;     }     return  YES n ;   }   int main() {     long int n;     cin >> n;     string s;     cin >> s;     vector<long> first, second;     for (int i = 0; i < n; i++) {       first.push_back(s[i] -  0 );     }     for (int i = n; i < 2 * n; i++) {       second.push_back(s[i] -  0 );     }     sort(first.begin(), first.end());     sort(second.begin(), second.end());     cerr << first << second;     cout << checkTicket(first, second);     return 0;   }   