// Original C++ solution (slower):
#include <bits/stdc++.h>



using namespace std;



template<class T, class U>

void ckmin(T &a, U b)

{

    if (a > b) a = b;

}



template<class T, class U>

void ckmax(T &a, U b)

{

    if (a < b) a = b;

}



#define MP make_pair

#define PB push_back

#define LB lower_bound

#define UB upper_bound

#define fi first

#define se second

#define SZ(x) ((int) (x).size())

#define ALL(x) (x).begin(), (x).end()

#define FOR(i, a, b) for (auto i = (a); i < (b); i++)

#define FORD(i, a, b) for (auto i = (a) - 1; i >= (b); i--)

#define MAXN 100013

#define INF 1000000007



typedef long long ll;

typedef long double ld;

typedef pair<int, int> pii;

typedef pair<ll, ll> pll;

typedef vector<int> vi;

typedef vector<ll> vl;

typedef vector<pii> vpi;

typedef vector<pll> vpl;



int N;

pii arr[MAXN];

int val[MAXN];

vi guys[MAXN];

bitset<MAXN> vis;



int32_t main()

{

    cout << fixed << setprecision(12);

    cerr << fixed << setprecision(4);

    ios_base::sync_with_stdio(false); cin.tie(0);

    cin >> N;

    FOR(i, 0, N)

    {

        cin >> arr[i].se; arr[i].se = -arr[i].se;

    }

    FOR(i, 0, N)

    {

        cin >> arr[i].fi; arr[i].fi = -arr[i].fi;

    }

    sort(arr, arr + N);

    //ai.se >= bi.se

    FOR(i, 0, N)

    {

        val[i] = UB(arr, arr + N, MP(arr[i].se, INF)) - arr - 1;

        if (val[i] < 0)

        {

            cout << "No\n";

            return 0;

        }

        guys[val[i]].PB(i);

    }

    int tot = 0;

    FOR(i, 0, N)

    {

        tot += SZ(guys[i]);

        if (tot > i + 1)

        {

            cout << "No\n";

            return 0;

        }

    }

    FOR(i, 0, N)

    {

        if (guys[i].empty())

        {

            cout << "Yes\n";

            return 0;

        }

    }

    int u = 0;

    FOR(i, 0, N)

    {

        vis[u] = true;

        u = guys[u][0];

    }

    FOR(i, 0, N)

    {

        if (!vis[i])

        {

            cout << "Yes\n";

            return 0;

        }

    }

    cout << "No\n";

    return 0;

    //i can go to [0...val[i]].

    //if there's only one guy that can go to 0, we assign it.

    //you can permute the arr[i].se in any order that's not a cycle. can you get all ai < bi?

}


// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;



namespace TYC

{

	typedef long long ll;

	typedef pair<int, int> pii;

	const int N = 1e5 + 5;



	int n, A[N], B[N], P[N];

	map<int, int> idA, idB;



	inline int read()

	{

		int x = 0, f = 0, ch = getchar();

		while (!isdigit(ch))

			f |= (ch == '-'), ch = getchar();

		while (isdigit(ch))

			x = x * 10 + ch - '0', ch = getchar();

		return f ? -x : x;

	}



	inline void End(const int t)

	{

		puts(t ? "Yes" : "No");

		exit(0);

	}



	void work()

	{

		n = read();

		for (int i = 1; i <= n; i++)

			A[i] = read(), idA[A[i]] = i;

		for (int i = 1; i <= n; i++)

			B[i] = read(), idB[B[i]] = i;

		sort(A + 1, A + 1 + n);

		sort(B + 1, B + 1 + n);

		for (int i = 1; i <= n; i++)

			if (A[i] > B[i])

				End(0);

		for (int i = 1; i < n; i++)

			if (A[i] == A[i + 1] || B[i] == B[i + 1])

				End(1);

		for (int i = 1; i <= n; i++)

			if (i < n && A[i + 1] <= B[i])

				End(1);

			else

				P[idA[A[i]]] = idB[B[i]];

		int c = 1, u = P[1];

		while (u != 1)

			c++, u = P[u];

		End(c != n);

	}

}



int main()

{

	TYC::work();

	return 0;

}

// Fastest known solution for this problem: