Problem: Nezzar designs a brand new game "Hidden Permutations" and shares it with his best friend, Nanako.

At the beginning of the game, Nanako and Nezzar both know integers n and m. The game goes in the following way:

  * Firstly, Nezzar hides two permutations p_1,p_2,…,p_n and q_1,q_2,…,q_n of integers from 1 to n, and Nanako secretly selects m unordered pairs (l_1,r_1),(l_2,r_2),…,(l_m,r_m); 
  * After that, Nanako sends his chosen pairs to Nezzar; 
  * On receiving those m unordered pairs, Nezzar checks if there exists 1 ≤ i ≤ m, such that (p_{l_i}-p_{r_i}) and (q_{l_i}-q_{r_i}) have different signs. If so, Nezzar instantly loses the game and gets a score of -1. Otherwise, the score Nezzar gets is equal to the number of indices 1 ≤ i ≤ n such that p_i ≠ q_i. 



However, Nezzar accidentally knows Nanako's unordered pairs and decides to take advantage of them. Please help Nezzar find out two permutations p and q such that the score is maximized.

Input

The first line contains a single integer t (1 ≤ t ≤ 5 ⋅ 10^5) — the number of test cases.

The first line of each test case contains two integers n,m (1 ≤ n ≤ 5 ⋅ 10^5, 0 ≤ m ≤ min((n(n-1))/(2),5 ⋅ 10^5)). 

Then m lines follow, i-th of them contains two integers l_i,r_i (1 ≤ l_i,r_i ≤ n, l_i ≠ r_i), describing the i-th unordered pair Nanako chooses. It is guaranteed that all m unordered pairs are distinct.

It is guaranteed that the sum of n for all test cases does not exceed 5 ⋅ 10^5, and the sum of m for all test cases does not exceed 5⋅ 10^5.

Output

For each test case, print two permutations p_1,p_2,…,p_n and q_1,q_2,…,q_n such that the score Nezzar gets is maximized.

Example

Input


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


Output


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

Note

For first test case, for each pair given by Nanako:

  * for the first pair (1,2): p_1 - p_2 = 1 - 2 = -1, q_1 - q_2 = 3 - 4 = -1, they have the same sign; 
  * for the second pair (3,4): p_3 - p_4 = 3 - 4 = -1, q_3 - q_4 = 1 - 2 = -1, they have the same sign. 



As Nezzar does not lose instantly, Nezzar gains the score of 4 as p_i ≠ q_i for all 1 ≤ i ≤ 4. Obviously, it is the maximum possible score Nezzar can get.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
void read (int &x) {
    char ch = getchar(); int f = 0; x = 0;
    while (!isdigit(ch)) { if (ch == '-') f = 1; ch = getchar(); }
    while (isdigit(ch)) x = x * 10 + ch - 48, ch = getchar();
    if (f) x = -x;
} const int N = 5e5 + 5;
int n, m, now, c[N], a[N], b[N], tp, st[N], num[N];
set<int> e[N]; vector<int> g[N];
void add (int u, int v) { e[u].insert (v), ++c[v]; }
void link (int u, int v) { g[u].push_back (v), ++num[v]; }
/* 构造补图中的 "star" 形————>构造补图的生成树（森立）————>从树中抽取 star */
vector<int> t[N]; int p, star[N], bl[N], sz[N];
void dfs (int u, int la) {
    st[++tp] = u;
    if (!bl[u]) {
        int tag = 0;
        for (int v : g[u]) if (!bl[v]) tag = 1;
        if (tag) {
            bl[u] = ++p, star[p] = u; sz[p] = 1;
            for (int v : g[u]) if (!bl[v]) bl[v] = p, ++sz[p];
        } else {
            int v = g[u][0];
            if (sz[bl[v]] > 2) {
                --sz[bl[v]], bl[v] = bl[u] = ++p, star[p] = u, sz[p] = 2;
            } else {
                bl[u] = bl[v], star[bl[v]] = v, ++sz[bl[v]];
                for (int o : g[v]) if (!bl[o]) bl[o] = bl[v], ++sz[bl[v]];
            }
        }
    }
    for (int v : g[u]) if (v != la) dfs (v, u);
}
void work () {
    for (int i = 1; i <= p; ++i) t[i].clear();
    for (int i = 1; i <= tp; ++i)
        if (st[i] != star[bl[st[i]]]) t[bl[st[i]]].push_back (st[i]);
    for (int i = 1; i <= p; ++i) {
        int s = 0;
        for (int j : t[i]) a[j] = now + s, b[j] = now + s + 1, ++s;
        a[star[i]] = now + s, b[star[i]] = now; now += s + 1; t[i].clear();
    }
}
int fa[N];
int get (int x) { return fa[x] == x ? x : fa[x] = get (fa[x]); }
void merge (int x, int y) { fa[get (x)] = get (y); }
signed main() {
    int T; read (T);
    for (int TT = 1; TT <= T; ++TT) {
        read (n), read (m); now = 1;
        // if (TT == 8) printf ("%d %d\n", n, m);
        for (int i = 1; i <= n; ++i)
            e[i].clear(), c[i] = num[i] = bl[i] = 0, g[i].clear();
        for (int i = 1, u, v; i <= m; ++i) {
            read (u), read (v), add (u, v), add (v, u);
            // if (TT == 8) printf ("%d %d\n", u, v);
        }
        for (int i = 1; i <= n; ++i) fa[i] = i;
        for (int i = 1; i <= n; ++i)
            if (c[i] != n - 1 && !num[i]) {
                for (int j = 1; j <= n; ++j)
                    if (i != j && e[i].find (j) == e[i].end ())
                        { link (i, j), link (j, i); break; }
            }   // 连边弄成一个森林
        // for (int i = 1; i <= n; ++i) {
        //     for (int j : g[i]) printf ("%d ", j); puts ("");
        // }
        for (int i = 1; i <= n; ++i) {
            if (c[i] == n - 1) a[i] = b[i] = now++;
            else if (!bl[i]) p = tp = 0, dfs (i, i), work ();
        }    // 开始华丽的构造star
        for (int i = 1; i <= n; ++i) printf ("%d ", a[i]); puts ("");
        for (int i = 1; i <= n; ++i) printf ("%d ", b[i]); puts ("");
    }
}