#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
#include <cassert>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>

#define cauto const auto&
#define ALL(v) begin(v),end(v)
#else
#define ALL(v) (v).begin(),(v).end()
#endif

using namespace std;


namespace{
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}
template <class T> inline T &chmin(T &x, const T &y){ return x = min(x, y); }
template <class T> inline T &chmax(T &x, const T &y){ return x = max(x, y); }
template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}


#define REP(i,n) for(int i=0;i<int(n);++i)
#define RALL(v) (v).rbegin(),(v).rend()


#define MOD 1000000007LL
#define EPS 1e-8

struct union_find{
	typedef unsigned size_type;
	vector<int> par;
	size_type grs;
	explicit union_find(size_type n = 0){ init(n); }
	void init(size_type n){
		par.assign(n, -1);
		grs = n;
	}
	size_type find(size_type x){
		if(par[x] < 0){ return x; }
		return par[x] = find(par[x]);
	}
	size_type size(size_type x){
		return -par[find(x)];
	}
	size_type groups(){
		return grs;
	}
	bool unite(size_type x, size_type y){
		x = find(x);
		y = find(y);
		if(x == y){ return false; }
		if(par[x] < par[y]){ swap(x, y); }
		par[y] += par[x];
		par[x] = y;
		--grs;
		return true;
	}
	bool same(size_type x, size_type y){
		return find(x) == find(y);
	}
	bool is_root(size_type x){
		return find(x) == x;
	}
};

bool check1(vint as, vint bs){
	int n = as.size();
	sort(ALL(as));
	sort(ALL(bs));
	for(int i = 0; i < n; ++i){
		if(as[i] > bs[i]){ return false; }
	}
	return true;
}

bool solve(){
	int n;
	scanf("%d", &n);
	vector<pii> ps(n);
	for(int i = 0; i < n; ++i){ scanf("%d", &ps[i].second); }
	for(int i = 0; i < n; ++i){ scanf("%d", &ps[i].first); }
	sort(ALL(ps));
	vector<int> as(n), bs(n);
	for(int i = 0; i < n; ++i){
		as[i] = ps[i].second;
		bs[i] = ps[i].first;
	}

	if(!check1(as, bs)){ return false; }

	vector<int> ls(n);
	for(int i = 0; i < n; ++i){
		ls[i] = lower_bound(ALL(bs), as[i]) - bs.begin();
		if(ls[i] >= n){ return false; }
	}

	if(set<int>(ALL(ls)).size() != n){ return true; }
	union_find uf(n);
	for(int i = 0; i < n; ++i){ uf.unite(i, ls[i]); }
	if(uf.groups() > 1){ return true; }

	return false;
}

void mainmain(){
	puts(solve() ? "Yes" : "No");
}



}
int main() try{
//	ios::sync_with_stdio(false); cin.tie(0);
	cout << fixed << setprecision(10);
	cerr << fixed << setprecision(4);
	mainmain();
}
catch(...){
	throw;
}


Measured memory_bytes: 6896