void main() {
    int n = readln.chomp.to!int;
    int[] a = readln.split.to!(int[]);
    int[] b = readln.split.to!(int[]);
    zip(a, b).sort!((t1, t2) => t1[0] > t2[0]);
    int cnt;
    bool ok = true;
    foreach (i; 0 .. n) {
        if (a[i] > b[i]) {
            long ind = a[i+1..$].countUntil!(x => x <= b[i]);
            if (ind != -1) {
                int tmp = a[i];
                a[i] = a[ind+i+1];
                a[ind+i+1] = tmp;
                ++cnt;
            } else {
                ok = false;
            }
        }
    }
    writeln(ok && cnt < n - 1 ? "Yes" : "No");
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.container;
import std.typecons;