import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class No216 { public static void main(String[] args) { try{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int N = Integer.parseInt(br.readLine()); String[] str = br.readLine().split(" "); String[] str2 = br.readLine().split(" "); int[] player = new int[101]; sakusei(N,player,str,str2); Hantei(player); }catch(IOException e){ e.getStackTrace(); }catch(NumberFormatException e){ e.getStackTrace(); } } public static void sakusei(int N,int[] x, String[] a, String[] b){ int[] score= new int[N]; int[] ansP = new int[N]; for(int i=0; i < N; i++){ score[i] = Integer.parseInt(a[i]); ansP[i] = Integer.parseInt(b[i]); x[ansP[i]] += score[i]; } } public static int getMax(int[] x){ int max = 0; for(int i=0; i< x.length; i++) if(x[i] > max) max = x[i]; return max; } public static void Hantei(int[] x){ if(x[0] >= getMax(x)) System.out.println("YES"); else System.out.println("NO"); } }