#include using namespace std; using ll=long long; #define rep(i,n) for(ll i=0;i>T; rep(t,T){ ll N; cin>>N; vector A(2*N),B(2*N); rep(i,2*N)cin>>A[i]; bool OK=0; rep(j,2*N)B[j]=(j%N)+1; if(A==B)OK=1; rep(i,N){ reverse(B.begin()+i,B.begin()+i+N+1); if(A==B)OK=1; reverse(B.begin()+i,B.begin()+i+N+1); } cout<<(OK?"Yes":"No")<