use std::collections::{BTreeMap, BTreeSet};

fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner(s.lock());

    let n: usize = sc.read();
    let a: Vec<u64> = sc.vec(n);
    let b: Vec<u64> = sc.vec(n);
    if solve(a, b) {
        println!("Yes");
    } else {
        println!("No");
    }
}

fn solve(mut a: Vec<u64>, mut b: Vec<u64>) -> bool {
    let n = a.len();

    let mut a = a
        .into_iter()
        .enumerate()
        .map(|(i, a)| (a, i))
        .collect::<Vec<_>>();
    b.sort();
    a.sort();
    for i in 0..n {
        if b[i] < a[i].0 {
            return false;
        }
    }

    let mut vis = vec![false; n];
    let mut cur = 0;
    vis[cur] = true;
    cur = a[cur].1;
    while cur != 0 {
        vis[cur] = true;
        cur = a[cur].1;
    }
    if vis.into_iter().any(|x| !x) {
        return true;
    }
    for i in 1..n {
        let a = a[i].0;
        if b[i - 1] >= a {
            return true;
        }
    }
    false
}

fn push(map: &mut BTreeMap<u64, usize>, v: u64) {
    *map.entry(v).or_insert(0) += 1;
}

fn remove(map: &mut BTreeMap<u64, usize>, v: u64) {
    let c = *map.get(&v).unwrap();
    if c == 1 {
        let removed = map.remove(&v).unwrap();
        assert_eq!(removed, 1);
    } else if c > 1 {
        map.insert(v, c - 1);
    } else {
        unreachable!()
    }
}

pub struct Scanner<R>(R);

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}
