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<iostream>
#include<cstring>
#include<cassert>
#include<cmath>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<vector>
#include<time.h>
#include<bitset>
#include<cstdio>
#include<algorithm>
using namespace std;
#define REP(i,x,y) for(int i=x;i<=y;i++)
#define rep(i,n) REP(i,1,n)
#define rep0(i,n) REP(i,0,n-1)
#define repG(i,x) for(int i=pos[x];~i;i=e[i].next)
#define ll long long
#define db double
const int N=5e5+7;
const int INF=1e9+7;
int T,n,m,num=0,cnt=0;
int dg[N],p[N],q[N],f[N],pos[N],tt[N],tp[N],vis[N],t[N],sz[N];
set<int>S[N];
int ff(int x){return (f[x]==x)?x:f[x]=ff(f[x]);}
struct edge{int v,next;}e[N*2];
void add(int x,int y){e[num]=(edge){y,pos[x]}; pos[x]=num++;}
vector<int>E[N],h[N];
void dfs(int x){
	vis[x]=1;
	tt[x]=-1;
	h[x].clear();
	int s0=-1;
	repG(i,x){
		if(vis[e[i].v])continue;
		dfs(e[i].v);
		if(tt[e[i].v]<0)h[x].push_back(e[i].v);
		if(s0<0)s0=e[i].v;
	}
	if(s0<0)return;
	if(!h[x].size()){
		if(tp[tt[s0]]==s0){
			tt[x]=tt[s0];
			sz[tt[s0]]++;
		}
		else{
			if(sz[tt[s0]]>2){
				sz[++cnt]=2;
				tt[s0]=tt[x]=cnt;
				tp[cnt]=x;
			}
			else{
				tt[x]=tt[s0];
				tp[tt[s0]]=s0;
				sz[tt[s0]]++;
			}
		}
	}
	else{
		sz[++cnt]=1;
		tp[cnt]=x;
		tt[x]=cnt;
		rep0(j,h[x].size()){
			tt[h[x][j]]=cnt;
			sz[cnt]++;
		}
	}
}
int main(){
	scanf("%d",&T);
	while(T--){
		scanf("%d%d",&n,&m);
		rep(i,n)dg[i]=0;
		rep(i,n)S[i].clear();
		rep(i,m){
			int u,v; scanf("%d%d",&u,&v);
			dg[u]++; dg[v]++;
			S[u].insert(v);
			S[v].insert(u);
		}
		int nw=n;
		rep(i,n)if(dg[i]==n-1)p[i]=q[i]=nw--;
		rep(i,n)f[i]=i,pos[i]=-1,vis[i]=0;
		num=cnt=0;
		rep(i,n){
			if(dg[i]==n-1)continue;
			int to;
			rep(j,n){
				if(j==i)continue;
				if(S[i].count(j))continue;
				to=j;
				break;
			}
			if(ff(to)!=ff(i)){
				f[ff(to)]=ff(i);
				add(to,i);
				add(i,to);
			}
			t[i]=to;
		}
		rep(i,n){
			if(dg[i]==n-1)continue;
			if(vis[i])continue;
			dfs(i);
		}
		rep(i,cnt)E[i].clear();
		rep(i,n)if(dg[i]!=n-1)E[tt[i]].push_back(i);
		int bg=1;
		rep(i,cnt){
			p[tp[i]]=bg;
			q[tp[i]]=bg+E[i].size()-1;
			int ww=0;
			for(int j=0;j<E[i].size();j++){
				if(E[i][j]==tp[i])continue;
				q[E[i][j]]=bg+ww;
				ww++;
				p[E[i][j]]=bg+ww;
			}
			bg+=E[i].size();
		}
		rep(i,n)printf("%d ",p[i]);
		puts("");
		rep(i,n)printf("%d ",q[i]);
		puts("");
	}
	return 0;
}