#include <bits/stdc++.h>
const long long INF = 1LL << 60;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  vector<int> a(n);
  vector<int> b(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    cin >> b[i];
    if (a[i] > b[i]) cnt++;
  }
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  for (int i = 0; i < n; i++) {
    if (a[i] > b[i]) {
      cout << "No" << endl;
      return 0;
    }
  }
  if (n - 2 >= cnt) {
    if (n / 2 < cnt)
      cout << "No" << endl;
    else
      cout << "Yes" << endl;
  } else
    cout << "No" << endl;
  return 0;
}
