#include #define rep(i,a,n) for (int i = a;i < n;i++) #define per(i,n,a) for (int i = n-1;i >= a;i--) using namespace std; int main(){ //input int n,a[100],b[100],ten[101] = {}; cin >> n; rep(i,0,n) cin >> a[i]; rep(i,0,n) cin >> b[i]; //solve rep(i,0,n){ ten[b[i]] += a[i]; } rep(i,1,101){ if(ten[0] > ten[i]){ cout << "YES" << endl; return 0; } } cout << "NO" << endl; return 0; }