#include <bits/stdc++.h>
using namespace std;
using int32 = int_fast32_t;
using int64 = int_fast64_t;
const int32 INF = 1e9;
const int32 MOD = 1e9 + 7;
const int64 LLINF = 1e18;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int32 n;
  cin >> n;
  vector<int32> a(n);
  vector<int32> b(n);
  vector<pair<int32, int32> > ab(n);
  for (int64 i = 0; i < (n); ++i) cin >> a[i];
  for (int64 i = 0; i < (n); ++i) cin >> b[i];
  for (int64 i = 0; i < (n); ++i) ab[i] = pair<int32, int32>(a[i], b[i]);
  sort((ab).begin(), (ab).end());
  priority_queue<int32> bpq;
  for (int64 i = 0; i < (n); ++i) {
    a[i] = ab[i].first;
    b[i] = ab[i].second;
    bpq.push(b[i]);
  }
  int32 larger = 0;
  for (int64 i = (n - 1); i >= (0); i--) {
    while (!bpq.empty() && a[i] <= bpq.top()) {
      larger++;
      bpq.pop();
    }
    if (larger <= 0) {
      cout << "No\n";
      return 0;
    }
    larger--;
  }
  cout << "Yes\n";
  return 0;
}
