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 <algorithm>
#include <cassert>
#include <iostream>
#include <queue>
#include <set>
#include <vector>

int main() {
  using namespace std;
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int t;
  cin >> t;
  while (t--) {
    int n, m;
    cin >> n >> m;
    using VI = vector<int>;
    using VVI = vector<VI>;
    VVI adj = VVI(n+1);
    for (int i = 0; i < m; ++i) {
      int li, ri;
      cin >> li >> ri;
      if (li > ri)
        swap(li, ri);
      adj[li].push_back(ri);
      adj[ri].push_back(li);
    }

    VVI cs = VVI(n+1);
    vector<int> toProcess;
    { // Find a spanning forest of the COMPLEMENT of the input graph
      // uses a set of unvisited to do this in O((n+m) log n)
      set<int> unvisited;
      for (int i = 1; i <= n; ++i)
        unvisited.insert(unvisited.end(), i);

      for (int i = 1; i <= n; ++i) {
        if (!unvisited.count(i))
          continue;
        unvisited.erase(i);
        if (n - 1 == int(adj[i].size()))
          continue; // no neighbors
        queue<int> qq;
        qq.push(i);
        while (!qq.empty()) { // BFS, on complement
          int currIx = qq.front();
          qq.pop();
          sort(adj[currIx].begin(), adj[currIx].end());
          int j = 0; // two-pointer, to track and avoid non-neighboring nodes
          int jmax = int(adj[currIx].size());
          for (int pc : unvisited) {
            while (j < jmax && adj[currIx][j] < pc)
              ++j;
            if (j < jmax && adj[currIx][j] == pc)
              continue; // not an edge in complement
            cs[currIx].push_back(pc);
          }
          for (int c : cs[currIx]) {
            unvisited.erase(c);
            qq.push(c);
          }
          /*
          cerr << "currIx = " << currIx << '\n';
          cerr << "adj[currIx] = ";
          for (int w : adj[currIx])
            cerr << w << ' ';
          cerr << '\n';
          cerr << "cs[currIx] = ";
          for (int c : cs[currIx])
            cerr << c << ' ';
          cerr << '\n';
          */
        } // performed BFS
        toProcess.push_back(i);
        assert(!cs[i].empty());
      } // considered all possible roots
    } // Found spanning forest

    // Break each nontrivial spanning tree into stars
    VVI stars;
    while (!toProcess.empty()) {
      int currIx = toProcess.back();
      toProcess.pop_back();
      assert(!cs[currIx].empty());
      stars.emplace_back();
      for (int c : cs[currIx])
        if (cs[c].empty())
          stars.back().push_back(c);
        else
          toProcess.push_back(c);
      if (!stars.back().empty())
        stars.back().push_back(currIx);
      else { // no leaf child, don't use currIx as center
        stars.pop_back();
        cs[cs[currIx].back()].push_back(currIx);
        cs[currIx].clear();
      }
    } // broken all into stars

    VI vis = VI(n+1, 0);
    VI p;
    VI q;
    p.reserve(n);
    q.reserve(n);
    for (VI& currStar : stars) {
      int center = currStar.back();
      currStar.pop_back();
      p.push_back(center);
      for (int x : currStar) {
        p.push_back(x);
        q.push_back(x);
        ++vis[x];
      }
      q.push_back(center);
      ++vis[center];
    }
    for (int i = 1; i <= n; ++i) {
      assert(0 <= vis[i]);
      assert(vis[i] <= 1);
      if (vis[i] == 0) {
        p.push_back(i);
        q.push_back(i);
      }
    }
    assert(p.size() == q.size());
    assert(int(p.size()) == n);
    VI pinv = VI(n);
    VI qinv = VI(n);
    for (int i = 1; i <= n; ++i) {
      pinv[p[i-1] - 1] = i;
      qinv[q[i-1] - 1] = i;
    }
    for (int pi : pinv)
      cout << pi << ' ';
    cout << '\n';
    for (int qi : qinv)
      cout << qi << ' ';
    cout << '\n';
    cout.flush();
  } // solved testcase

  return 0;
}