#include using namespace std; typedef long long LL; const int maxn = 200005; const LL mod = 1000000007; int T, n, a[maxn]; map S; LL fac[maxn], ans; LL quickpow(LL x, LL b) { LL ans = 1; while (b) { if (b & 1ll) (ans *= x) %= mod; (x *= x) %= mod; b >>= 1; } return ans; } LL inv(LL x) { return quickpow(x, mod - 2); } LL C(int n, int m) { return fac[n] * inv(fac[m]) % mod * inv(fac[n - m]) % mod; } int main() { fac[0] = fac[1] = 1; for (int i = 2; i < maxn; ++i) { fac[i] = fac[i - 1] * i % mod; } for (scanf("%d", &T); T--; ) { scanf("%d", &n); S.clear(); for (int i = 1, x; i <= 2 * n; ++i) { scanf("%d", &x); if (!S.count(x)) S[x] = 1; else ++S[x]; } LL ans = 1; int tot = 0; for (map::iterator iter = S.begin(); iter != S.end(); ++iter) { int x = iter->second; if (tot % 2 == 0) { (ans *= C(x, x / 2)) %= mod; if (x % 2 == 1) (ans <<= 1) %= mod; } else { if (x % 2 == 1) { (ans *= C(x, x / 2)) %= mod; } else { (ans *= ((C(x, x / 2 + 1) + C(x, x / 2)) % mod)) %= mod; } } tot += iter->second; } cout << ans << endl; } return 0; }