import sequtils, strutils, tables let n, aa, bb = stdin.readLine.split.map parseInt var cnts = initCountTable[int]() for (a, b) in aa.zip bb: if cnts.hasKey b: cnts.inc b, a else: cnts[b] = a echo ["NO", "YES"][int cnts.largest[1] == cnts[0]]