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