#include #include using namespace std; int main(){ int n,a[n],b[n],all[101]={}; cin >> n; for(int i=0;i> a[i]; for(int i=0;i> b[i]; all[b[i]]+=a[i]; } cout << (all[0] == *max_element(all,all+101)? "YES":"NO") << endl; return 0; }