import java.util.Scanner
import kotlin.system.exitProcess

fun main(args: Array<String>) {
	val scn = Scanner(System.`in`)
	val n = scn.nextInt()
	var la = IntArray(n){scn.nextInt()}
	val lb = IntArray(n){scn.nextInt()}
	val ordB = lb.indices.sortedBy { lb[it] }
	la = IntArray(n){la[ordB[it]]}
	lb.sort()
	val aSrt = la.sorted().toIntArray()
	if (ordB.indices.any{aSrt[it]>lb[it]}) ans(false)
	val ordA = la.indices.sortedBy { la[it] }
	var k = 0
	var cnt = 0
	while(true){
		k = ordA[k]
		cnt++
		if (k==0) break
	}
	if (cnt!=n) ans(true)
	ans((0 until n-1).any{lb[it]>=aSrt[it+1]})
}

fun ans(ans: Boolean){
	println(if (ans) "Yes" else "No")
	exitProcess(0)
}