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 For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define pii pair<int,int>
#define fi first
#define se second
#define PB push_back
#define ll long long
#define ull unsigned long long
#define pll pair<ll,ll> 
#define y1 orzkcz
using namespace std;
const int N=500005;
int n,m,deg[N];
int vis[N],q[N],rem;
int ban[N],qq[N];
int perm1[N],perm2[N];
vector<int> e[N],vq[N],E[N],f[N];

int dfs(int x,int fa){
	f[x].PB(x);
	for (auto i:E[x])
		if (i!=fa){
			int v=dfs(i,x);
			if (v) f[x].PB(v);
		}
	if (f[x].size()==1) return x;
	return 0;
}
void solve(int x){
	int h=0,t=1;
	qq[t]=x; vis[x]=1;
	while (h!=t){
		int x=qq[++h];
		for (auto i:e[x]) ban[i]=1;
		int nt=0;
		For(i,1,*q)
			if (!ban[q[i]]){
				if (!vis[q[i]]){
					vis[q[i]]=1;
					qq[++t]=q[i];
					E[q[i]].PB(x);
					E[x].PB(q[i]);
				}
			}
			else q[++nt]=q[i];
		*q=nt;
		for (auto i:e[x]) ban[i]=0;
	}
	For(i,1,t) f[qq[i]].resize(0);
	if (dfs(qq[1],0))
		if (f[qq[1]].size()==1)
			f[E[qq[1]][0]].PB(qq[1]);
	For(i,1,t) if (f[qq[i]].size()!=1){
		//for (auto j:f[qq[i]]) cout<<j<<endl;
		For(j,0,f[qq[i]].size()-1){
			int p1=j,p2=(j+1)%f[qq[i]].size();
			perm1[f[qq[i]][p1]]=rem;
			perm2[f[qq[i]][p2]]=rem;
			--rem; 
		}
	}
}
void solve(){
	scanf("%d%d",&n,&m);
	For(i,1,n) e[i].resize(0);
	For(i,1,n) E[i].resize(0);
	For(i,1,m){
		int x,y;
		scanf("%d%d",&x,&y);
		e[x].PB(y); e[y].PB(x);
	}
	For(i,0,n) vq[i].resize(0);
	For(i,1,n) deg[i]=e[i].size(),vis[i]=0;
	For(i,1,n) vq[deg[i]].PB(i);
	rem=n;
	for (;rem;){
		int p=-1;
		for (auto i:vq[rem-1])
			if (deg[i]==rem-1)
				p=i;
		if (p==-1) break;
		perm1[p]=perm2[p]=rem;
		vis[p]=1; --rem;
		for (auto i:e[p])
			vq[--deg[i]].PB(i);
	}
	*q=0;
	For(i,1,n) if (!vis[i]) q[++*q]=i;
	For(i,1,n) if (!vis[i]) solve(i);
	For(i,1,n) printf("%d ",perm1[i]); puts("");
	For(i,1,n) printf("%d ",perm2[i]); puts(""); 
}
int main(){
	int T;
	scanf("%d",&T);
	while (T--) solve();
}