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<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB emplace_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(int64_t &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const int64_t &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("[DEBUG] ");W(__VA_ARGS__);}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1<<20;
int n,m;
int l[SIZE],r[SIZE];
int my_rand(int lb, int ub) {
    LL x=((LL)rand()<<14)^rand();
    return lb+x%(ub-lb+1);
}
set<int>e[SIZE];
int con[SIZE];
int rd[SIZE];
int an[2][SIZE];
bool disapear[SIZE];
void del(set<PII>&AA, int x) {
    disapear[x]=1;
    AA.erase(MP(SZ(e[x]), x));
    for(int y: e[x]) {
        if(disapear[y]){
            continue;
        }
        AA.erase(MP(SZ(e[y]),y));
        e[y].erase(x);
        con[y]^=rd[x];
        AA.insert(MP(SZ(e[y]),y));
    }
}
void solve() {
    set<PII>AA;
    FOR(i,1,n){
        AA.insert(MP(SZ(e[i]),i));
        disapear[i] = 0;
    }
    int rr=n;
    while(1 <= rr){
        int x=AA.rbegin()->S;
        if(AA.rbegin()->F==rr-1){
            an[0][x]=an[1][x]=rr;
            rr--;
            del(AA, x);
        } else {
            VI sp{x};
            for(int y: e[x]) {
                if(con[y] == con[x]) {
                    sp.PB(y);
                }
            }
            REP(i,SZ(sp)){
                DEBUG(rr-SZ(sp)+i+1,SZ(e[x])-SZ(sp)+2+i,sp[i]);
                an[0][sp[i]] = rr-SZ(sp)+i+1;
                an[1][sp[i]] = SZ(e[x])-SZ(sp)+2+i;
            }
            int it1 = SZ(e[x]) - SZ(sp) + 2;
            int it2 = SZ(e[x]) + 2;
            VI save;
            for(auto z: AA) {
                if(z.S!=x && !e[z.S].count(x)) {
                    save.PB(z.S);
                    an[0][z.S] = it1++;
                    an[1][z.S] = it2++;
                }
            }
            for(int z: sp) {
                del(AA, z);
            }
            for(int z: save) {
                del(AA, z);
            }
            rr -= SZ(sp) + SZ(save);
        }
    }
    REP(i,2){
        W(VI(an[i]+1,an[i]+n+1));
    }
}
void input() {
    R(n,m);
    FOR(i,1,n){
        e[i].clear();
        con[i] = rd[i] = my_rand(0,INT_MAX);
    }
    REP(i,m){
        R(l[i],r[i]);
        e[l[i]].insert(r[i]);
        e[r[i]].insert(l[i]);
        con[l[i]] ^= rd[r[i]];
        con[r[i]] ^= rd[l[i]];
    }
}
int main(){
    CASET {
        input();
        solve();
    }
    return 0;
}