import core.bitop, std.bitmanip;
import core.checkedint;
import std.algorithm, std.functional;
import std.array, std.container;
import std.bigint;
import std.conv;
import std.math, std.numeric;
import std.range, std.range.interfaces;
import std.stdio, std.string;
import std.typecons;

void main()
{
    int n;
    readf("%s", &n);
    readln;
    
    auto arra = readln.chomp.split.map!(to!int).array;
    auto arrb = readln.chomp.split.map!(to!int).array;
    
    auto zipped = zip(arrb, arra).sort().array;
    
    arra.sort();
    arrb.sort();
    
    foreach (i; 0 .. n) {
        if (arrb[i] < arra[i]) {
            writeln("No");
            return;
        }
    }
    
    foreach (i; 1 .. n) {
        if (arra[i] <= arrb[i-1]
            || 
            (zipped[i][1] <= zipped[i][0] && zipped[i][1] > zipped[i-1][0])) {
            writeln("Yes");
            return;
        }
    }
    
    if (zipped[0][1] >= zipped[0][0]) {
        writeln("Yes");
        return;
    }
    
    writeln("No");
    return;
}