#include const int M = 1000000007; const int _n = 200000 + 10; int T; int n; int c[_n]; int up[_n], down[_n]; int now; int f[_n][2]; int C(int n, int m) { if (n < m) { return 0; } return (long long)up[n] * down[m] % M * down[n - m] % M; } int main() { up[0] = 1; for (int i = 1; i <= 200000; i++) { up[i] = (long long)up[i - 1] * i % M; } down[0] = down[1] = 1; for (int i = 2; i <= 200000; i++) { down[i] = (long long)(M - M / i) * down[M % i] % M; } for (int i = 2; i <= 200000; i++) { down[i] = (long long)down[i - 1] * down[i] % M; } scanf("%d", &T); while (T--) { scanf("%d", &n); n = n * 2; for (int i = 1; i <= n; i++) { c[i] = 0; f[i][0] = f[i][1] = 0; } for (int i = 1; i <= n; i++) { int x; scanf("%d", &x); c[x]++; } now = 0; f[0][0] = 1; for (int i = 1; i <= n; i++) { int x = now; now += c[i]; f[i][0] = ((long long)f[i - 1][0] * C(c[i], now / 2 - x / 2) % M + (long long)f[i - 1][1] * C(c[i], now / 2 - x / 2 - 1) % M) % M; if (now & 1) { f[i][1] = ((long long)f[i - 1][0] * C(c[i], now / 2 - x / 2 + 1) % M + (long long)f[i - 1][1] * C(c[i], now / 2 - x / 2) % M) % M; } else { f[i][1] = 0; } } printf("%d\n", f[n][0]); } return 0; }