#include using namespace std; #define LL long long const int mx =2e5+5; const long long mo = 1e9+7; int a[mx]; long long dp[mx][3]; long long inv[mx]; void init() { inv[0]=inv[1]=1; for (int i=2;i>t; while (t--) { int n; scanf("%d",&n); int cut = 0,p=0,w,k=-1; for (int i=0;i<2*n;i++) { scanf("%d",&w); if (w==k) cut++; else { if (cut!=0) { a[p++]=cut; } cut=1; k = w; } } a[p++]=cut; if (a[0]%2==0) { dp[0][2]= c(a[0],a[0]/2); dp[0][0]=dp[0][1]=0; } else { dp[0][0]=dp[0][1]=c(a[0],a[0]/2); dp[0][2]=0; } // cout<0) { dp[i][2]= dp[i-1][2]*c(a[i],a[i]/2)%mo; dp[i][0]=dp[i][1]=0; } else { dp[i][1]= dp[i][0] = (dp[i-1][0]*c(a[i],a[i]/2) + dp[i-1][1]*c(a[i],a[i]/2-1))%mo; dp[i][2]=0; // dp[i][1] = (dp[i-1][1]*c(a[i],a[i]/2)%mo + dp[i-1][0]*c(a[i],a[i]/2-1)%mo)%mo; } } else { if (dp[i-1][2]>0) { dp[i][0]=dp[i][1]=dp[i-1][2]*c(a[i],a[i]/2)%mo; dp[i][2]=0; } else { dp[i][2]= 2*dp[i-1][0]*c(a[i],a[i]/2) %mo; dp[i][0]=dp[i][1]=0; // cout<