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.
#include <bits/stdc++.h>
 
using namespace std;
 
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int tt;
  cin >> tt;
  while (tt--) {
    int n, m;
    cin >> n >> m;
    vector<vector<int>> g(n);
    for (int i = 0; i < m; i++) {
      int x, y;
      cin >> x >> y;
      --x; --y;
      g[x].push_back(y);
      g[y].push_back(x);
    }
    for (int i = 0; i < n; i++) {
      sort(g[i].begin(), g[i].end());
    }
    set<int> alive;
    for (int i = 0; i < n; i++) {
      alive.insert(i);
    }
    vector<int> p(n);
    vector<int> q(n);
    vector<vector<int>> tree(n);
    vector<vector<int>> star(n);
    vector<int> que;
    vector<pair<int, int>> edges;
    vector<pair<int, int>> mats;
    vector<bool> taken(n, false);
    int done = 0;
    vector<vector<int>> stars;
    vector<int> cur_star;
    while (!alive.empty()) {
      que.clear();
      que.push_back(*alive.begin());
      alive.erase(alive.begin());
      edges.clear();
      for (int b = 0; b < (int) que.size(); b++) {
        int me = que[b];
        auto it = alive.begin();
        int ptr = 0;
        while (it != alive.end()) {
          while (ptr < (int) g[me].size() && g[me][ptr] < *it) {
            ++ptr;
          }
          if (ptr < (int) g[me].size() && g[me][ptr] == *it) {
            ++it;
          } else {
            tree[me].push_back(*it);
            tree[*it].push_back(me);
            edges.emplace_back(me, *it);
            que.push_back(*it);
            it = alive.erase(it);
          }
        }
      }
      if ((int) que.size() == 1) {
        p[que[0]] = done;
        q[que[0]] = done;
        done += 1;
        continue;
      }
      mats.clear();
      for (auto& e : edges) {
        if (!taken[e.first] && !taken[e.second]) {
          taken[e.first] = true;
          taken[e.second] = true;
          mats.push_back(e);
        }
      }
      for (int x : que) {
        if (!taken[x]) {
          int y = tree[x][0];
          assert(taken[y]);
          star[y].push_back(x);
        }
      }
      for (auto& e : mats) {
        int x = e.first;
        int y = e.second;
        if (star[y].empty()) {
          swap(x, y);
        }
        if (star[x].empty()) {
          cur_star.clear();
          cur_star.push_back(y);
          cur_star.push_back(x);
          for (int u : star[y]) {
            cur_star.push_back(u);
          }
          stars.push_back(cur_star);
          continue;
        }
        assert(!star[x].empty() && !star[y].empty());
        for (int rot = 0; rot < 2; rot++) {
          int z = (rot == 0 ? x : y);
          cur_star.clear();
          cur_star.push_back(z);
          for (int u : star[z]) {
            cur_star.push_back(u);
          }
          stars.push_back(cur_star);
        }
      }
    }
    for (auto& s : stars) {
      int sz = (int) s.size();
      for (int i = 0; i < sz; i++) {
        p[s[i]] = done + i;
      }
      q[s[0]] = done + sz - 1;
      for (int i = 1; i < sz; i++) {
        q[s[i]] = done + i - 1;
      }
      done += sz;
    }
    assert(done == n);
    for (int i = 0; i < n; i++) {
      if (i > 0) {
        cout << " ";
      }
      cout << p[i] + 1;
    }
    cout << '\n';
    for (int i = 0; i < n; i++) {
      if (i > 0) {
        cout << " ";
      }
      cout << q[i] + 1;
    }
    cout << '\n';
  }
  return 0;
}