Problem: Cirno has prepared n arrays of length n each. Each array is a permutation of n integers from 1 to n. These arrays are special: for all 1 ≤ i ≤ n, if we take the i-th element of each array and form another array of length n with these elements, the resultant array is also a permutation of n integers from 1 to n. In the other words, if you put these n arrays under each other to form a matrix with n rows and n columns, this matrix is a [Latin square](https://en.wikipedia.org/wiki/Latin_square).

Afterwards, Cirno added additional n arrays, each array is a permutation of n integers from 1 to n. For all 1 ≤ i ≤ n, there exists at least one position 1 ≤ k ≤ n, such that for the i-th array and the (n + i)-th array, the k-th element of both arrays is the same. Notice that the arrays indexed from n + 1 to 2n don't have to form a Latin square. 

Also, Cirno made sure that for all 2n arrays, no two arrays are completely equal, i. e. for all pair of indices 1 ≤ i < j ≤ 2n, there exists at least one position 1 ≤ k ≤ n, such that the k-th elements of the i-th and j-th array are different.

Finally, Cirno arbitrarily changed the order of 2n arrays.

AquaMoon calls a subset of all 2n arrays of size n good if these arrays from a Latin square.

AquaMoon wants to know how many good subsets exist. Because this number may be particularly large, find it modulo 998 244 353. Also, she wants to find any good subset. Can you help her?

Input

The input consists of multiple test cases. The first line contains a single integer t (1 ≤ t ≤ 100) — the number of test cases.

The first line of each test case contains a single integer n (5 ≤ n ≤ 500).

Then 2n lines followed. The i-th of these lines contains n integers, representing the i-th array.

It is guaranteed, that the sum of n over all test cases does not exceed 500.

Output

For each test case print two lines.

In the first line, print the number of good subsets by modulo 998 244 353.

In the second line, print n indices from 1 to 2n — indices of the n arrays that form a good subset (you can print them in any order). If there are several possible answers — print any of them.

Example

Input


3
7
1 2 3 4 5 6 7
2 3 4 5 6 7 1
3 4 5 6 7 1 2
4 5 6 7 1 2 3
5 6 7 1 2 3 4
6 7 1 2 3 4 5
7 1 2 3 4 5 6
1 2 3 4 5 7 6
1 3 4 5 6 7 2
1 4 5 6 7 3 2
1 5 6 7 4 2 3
1 6 7 5 2 3 4
1 7 6 2 3 4 5
1 7 2 3 4 5 6
5
4 5 1 2 3
3 5 2 4 1
1 2 3 4 5
5 2 4 1 3
3 4 5 1 2
2 3 4 5 1
1 3 5 2 4
4 1 3 5 2
2 4 1 3 5
5 1 2 3 4
6
2 3 4 5 6 1
3 1 2 6 4 5
6 1 2 3 4 5
5 6 1 3 2 4
4 3 6 5 2 1
5 6 1 2 3 4
4 5 6 1 2 3
3 4 5 6 1 2
1 2 3 4 5 6
2 5 4 1 6 3
3 2 5 4 1 6
1 4 3 6 5 2


Output


1
1 2 3 4 5 6 7
2
1 3 5 6 10
4
1 3 6 7 8 9

Note

In the first test case, the number of good subsets is 1. The only such subset is the set of arrays with indices 1, 2, 3, 4, 5, 6, 7.

In the second test case, the number of good subsets is 2. They are 1, 3, 5, 6, 10 or 2, 4, 7, 8, 9.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>

#define range(i, n) for (int i = 0; i < (n); ++i)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define ar array

using namespace std;

typedef long long ll;
typedef double ld;
typedef unsigned long long ull;

const ll INF = 2e18;
const int INFi = 2e9 + 5;
const int maxN = 1500 + 1;
const int md = 998244353;


inline int add(const int &a, const int &b) {
    return a + b >= md ? a + b - md : a + b;
}

inline int sub(const int &a, const int &b) {
    return a - b < 0 ? a - b + md : a - b;
}

inline int mul(const int &a, const int &b) {
    return (1ll * a * b) % md;
}

int binpow(int a, int b) {
    if (b <= 0) return 1;
    if (b % 2) return mul(a, binpow(a, b - 1));
    int m = binpow(a, b / 2);
    return mul(m, m);
}

int rev(int a) {
    return binpow(a, md - 2);
}

const int maxF = 2e5 + 5;
int fact[maxF];
int rfact[maxF];

void init() {
    fact[0] = 1;
    for (int i = 1; i < maxF; ++i) fact[i] = mul(fact[i - 1], i);
    rfact[maxF - 1] = rev(fact[maxF - 1]);
    for (int i = maxF - 1; i >= 1; --i) {
        rfact[i - 1] = mul(rfact[i], i);
    }
}

int C(int n, int k) {
    if (k < 0 || n < k) return 0;
    return mul(fact[n], mul(rfact[k], rfact[n - k]));
}

int T(int n, int k) {
    return C(n + k - 1, k - 1);
}

vector<int> g[maxN];
int col[maxN];
int cnt[3];
void dfs(int v, int c) {
    col[v] = c;
    cnt[c]++;
    for (auto &u : g[v]) {
        if (col[u] == 0) {
            dfs(u, c ^ 3);
        }
        if ((col[v] ^ col[u]) != 3) {
            assert(0);
        }
    }
}

void solve() {
    int n;
    cin >> n;
    vector<vector<int>> a(n * 2, vector<int>(n));
    range(i, n * 2) range(j, n) cin >> a[i][j];
    range(i, n * 2) range(j, n) a[i][j]--;
    vector<vector<set<int>>> to(n, vector<set<int>>(n));
    vector<vector<bool>> used(n, vector<bool>(n));
    vector<int> c(n * 2, 0);
    // 0 - neutral
    // 1 - always good
    // -1 - always bad
    range(i, n * 2) {
        range(j, n) {
            to[j][a[i][j]].insert(i);
        }
    }
    queue<pair<int, int>> q;
    bool bad = false;
    int cntGood = 0;
    int cntBad = 0;
    auto DoGood = [&](int i) {
        c[i] = 1;
        cntGood++;
        range(j, n) {
            to[j][a[i][j]].erase(i);
            if (used[j][a[i][j]]) bad = true;
            used[j][a[i][j]] = true;
            q.push({j, a[i][j]});
        }
    };
    auto DoBad = [&](int i) {
        c[i] = -1;
        cntBad++;
        range(j, n) {
            to[j][a[i][j]].erase(i);
            if (!used[j][a[i][j]] && to[j][a[i][j]].size() == 1) {
                q.push({j, a[i][j]});
            }
        }
    };
    range(s, n) {
        range(v, n) {
            q.push({s, v});
        }
    }
    while (!q.empty()) {
        auto[s, v] = q.front();
        q.pop();
        if (used[s][v]) {
            while (!to[s][v].empty()) {
                int x = *to[s][v].begin();
                DoBad(x);
            }
        } else if (to[s][v].size() == 1) {
            int x = *to[s][v].begin();
            DoGood(x);
        }
    }
    int cntEdges2 = 0;
    range(i, n * 2) {
        g[i].clear();
        col[i] = 0;
    }
    range(j, n) {
        range(v, n) {
            if (used[j][v]) continue;
            assert(to[j][v].size() == 2);
            if (to[j][v].size() > 2) continue;
            int x = *to[j][v].begin();
            int y = *to[j][v].rbegin();
            cntEdges2++;
            g[x].push_back(y);
            g[y].push_back(x);
        }
    }
    int ans = 1;
    range(i, n * 2) {
        if (col[i] || c[i] != 0) continue;
        cnt[1] = cnt[2] = 0;
        dfs(i, 1);
        //cout << cnt[1] << ' ' << cnt[2] << '\n';
        ans = mul(ans, 2);
    }
    assert(!bad);
//    cout << n << ' ' << cntGood << ' ' << cntBad << ' ' << cntEdges2 << '\n';
    cout << ans << '\n';
    range(i, n * 2) {
        if (col[i] == 1 || c[i] == 1) cout << i + 1 << ' ';
    }
    cout << '\n';
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    init();
    // cout << setprecision(15) << fixed;
    int tests = 1;
    cin >> tests;
    range(_, tests) {
        solve();
    }
    return 0;
}