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.
//zxggtxdy!
#include<bits/stdc++.h>
using namespace std;
const int N=5e5+7; bool fl[N],fp[N];
int n,m,k,sn,x[N],y[N],f[N],p[N],q[N],g[N],st[N],rt[N],lt[N],deg[N]; vector<int>v[N],w[N],c[N],z[N];
struct node{
	int u,t;
};
inline bool operator < (node A,node B){
	return A.t<B.t;
}
priority_queue<node>gt;
inline int read(){
	int num=0; char g=getchar(); while(g<48||57<g) g=getchar();
	while(47<g&&g<58) num=(num<<1)+(num<<3)+g-48,g=getchar(); return num;
}
inline int find(int u){
	if(f[u]==u) return f[u]; return f[u]=find(f[u]);
}
inline void dfs(int u,int fa){
	fp[u]=1;
	for(int i=0;i<w[u].size();i++){
		int x=w[u][i]; if(fa==x) continue; dfs(x,u);
	}
	if(c[u].size()) c[u].push_back(u); else if(fa>0) c[fa].push_back(u); else c[w[u][0]].push_back(u);
}
int main(){
	int t=read(); int Cnt=0;
	while(t--){
		n=read(),m=read(),k=0,sn=n-1; int a,b; node T,Q; Cnt++;
		for(int i=1;i<=n;i++) v[i].resize(0),w[i].resize(0),c[i].resize(0),deg[i]=0,p[i]=0,q[i]=0,fp[i]=0;
		for(int i=1;i<=m;i++) a=read(),b=read(),v[a].push_back(b),v[b].push_back(a),deg[a]++,deg[b]++,x[i]=a,y[i]=b;
		for(int i=1;i<=n;i++) T.u=i,T.t=deg[i],gt.push(T);
		while(gt.size()){
			T=gt.top(),gt.pop();
			if(deg[T.u]!=T.t||deg[T.u]!=sn) continue; sn--,p[T.u]=++k,q[T.u]=k;
			for(int j=0;j<v[T.u].size();j++)
				if(!p[v[T.u][j]]) deg[v[T.u][j]]--,Q.t=deg[v[T.u][j]],Q.u=v[T.u][j],gt.push(Q);
		}
		int siz=1;
		for(int i=1;i<=n;i++) if(!p[i]) f[i]=i; else f[i]=0; sn++;
		for(int s=1;s<=20;s++){
			for(int i=0;i<=n;i++) z[i].resize(0);
			for(int i=1;i<=n;i++) fl[i]=0,rt[i]=0,z[find(i)].push_back(i); st[0]=0;
			for(int i=1;i<=n;i++) if(!p[i]&&!fl[find(i)]) fl[find(i)]=1,st[++st[0]]=find(i);
			for(int i=1;i<=n;i++) rt[find(i)]++;
			for(int i=1;i<=n;i++){
				if(p[i]) continue; g[i]=0;
				for(int j=0;j<v[i].size();j++) rt[find(v[i][j])]--,lt[v[i][j]]=1;
				for(int j=1;j<=st[0];j++){
					int u=st[j]; if(rt[u]&&find(i)!=u) {g[i]=u; break;}
				}
				if(g[i]){
					for(int j=0;j<z[g[i]].size();j++)
						if(!lt[z[g[i]][j]]){
							g[i]=z[g[i]][j]; break;
						}
				}
				for(int j=0;j<v[i].size();j++) rt[find(v[i][j])]++,lt[v[i][j]]=0;
			}
			for(int i=1;i<=n;i++)
				if(!p[i]&&g[i]&&find(i)!=find(g[i]))
					w[g[i]].push_back(i),w[i].push_back(g[i]),f[find(i)]=find(g[i]),siz++;
		}
		int s=0;
		for(int i=1;i<=n;i++) if(!p[i]&&!fp[i]) dfs(i,0);
		for(int i=1;i<=n;i++)
			if(c[i].size()>0){
				p[i]=++k;
				for(int j=0;j<c[i].size();j++) if(!p[c[i][j]]) p[c[i][j]]=k+1,q[c[i][j]]=k,k++;
				q[i]=k;
			}
		for(int i=1;i<=n;i++) printf("%d ",p[i]); puts("");
		for(int i=1;i<=n;i++) printf("%d ",q[i]); puts("");
	}
	return 0;
}