#include using namespace std; using Int=long long; using Real=long double; templateinline bool chmin(T&A,S B){if(A>B){A=B;return true;}else{return false;}} templateinline bool chmax(T&A,S B){if(A>N; REP(i,N)cin>>A[i]; REP(i,N)cin>>B[i]; REP(i,N)C[B[i]]+=A[i]; cout<<(C[0]>=*max_element(C+1,C+101)?"YES":"NO")<<"\n"; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); cout<>TE; while(TE--)sol(); }