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>
#define pb push_back
using namespace std;
#define G getchar()
int read()
{
	int x=0; bool flg=false; char ch=G;
	for (;!isdigit(ch);ch=G) if (ch=='-') flg=true;
	for (;isdigit(ch);ch=G) x=(x<<3)+(x<<1)+(ch^48);
	return flg?-x:x;
}
#undef G
#define fi first
#define se second
typedef long long ll;
/*const int mod=;
inline int upd(const int &x){return x+(x>>31&mod);}
inline void add(int &x,const int &y){x=upd(x+y-mod);}
inline void iadd(int &x,const int &y){x=upd(x-y);}
int qpow(int x,int y){
	int res=1;
	for (;y;y>>=1,x=1LL*x*x%mod)
		if (y&1) res=1LL*res*x%mod;
	return res;
}*/
#define rep(i,l,r) for (int i(l);i<=(r);i++)
#define per(i,l,r) for (int i(r);i>=(l);i--)

int n,m;
vector<int> e[500010];
int tot;
int p[500010],q[500010];
list<int> lst;
vector<int> g[500010];


int que[500010],hd,tl;
int ban[500010];
vector<int> h[500010];
bool dp[500010];
void dfs(int x,int f){
	bool s=1; int z=-1;
	for (int y: h[x]) dfs(y,x),s&=dp[y],z=y;
	if (s){
		dp[x]=0;
		if (!f) g[z].pb(x);
	}
	else{
		dp[x]=1;
		for (int y: h[x]) if (!dp[y]) g[x].pb(y);
	}
}
void bfs(int S){
	hd=tl=0; que[++tl]=S;
	while (hd<tl){
		int u=que[++hd];
		for (int v: e[u]) ban[v]=u;
		for (auto cur=lst.begin(),nxt=cur;cur!=lst.end();cur=nxt){
			nxt=cur,++nxt;
			if (ban[*cur]^u)  h[u].pb(*cur),que[++tl]=*cur,lst.erase(cur);
		}
	}
	dfs(S,0);
}

void solve(){  //init
	n=read(); m=read();
	
	tot=0;
	rep(i,1,n) e[i].clear(),g[i].clear(),h[i].clear(),ban[i]=0;
	lst.clear();
	
	rep(i,1,m){
		int u=read(),v=read();
		e[u].pb(v),e[v].pb(u);
	}
	rep(i,1,n) if (int(e[i].size())==n-1) p[i]=q[i]=++tot; else lst.pb(i);
	while (lst.begin()!=lst.end()){
		int u=*lst.begin(); lst.erase(lst.begin());
		bfs(u);
	}
	rep(i,1,n){
		if (!g[i].size()) continue;
		int S=g[i].size();
		rep(j,0,S-1) p[g[i][j]]=tot+j+1,q[g[i][j]]=tot+j+2;
		p[i]=tot+S+1; q[i]=tot+1;
		tot+=S+1;
	}
	rep(i,1,n) printf("%d%c",p[i]," \n"[i==n]);
	rep(i,1,n) printf("%d%c",q[i]," \n"[i==n]);
}
int main()
{
	for (int T=read();T--;) solve();
}