#include #include using namespace std; int N,A[5000],B[5000]; bool vis[5000]; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int T; cin>>T; for(;T--;) { cin>>N; for(int i=0;i>A[i],A[i]--; for(int i=0;i>B[i],B[i]--; bool ok=true; for(int i=0;i