Problem: You are given an undirected unweighted connected graph consisting of n vertices and m edges. It is guaranteed that there are no self-loops or multiple edges in the given graph.

Your task is to find any spanning tree of this graph such that the degree of the first vertex (vertex with label 1 on it) is equal to D (or say that there are no such spanning trees). Recall that the degree of a vertex is the number of edges incident to it.

Input

The first line contains three integers n, m and D (2 ≤ n ≤ 2 ⋅ 10^5, n - 1 ≤ m ≤ min(2 ⋅ 10^5, (n(n-1))/(2)), 1 ≤ D < n) — the number of vertices, the number of edges and required degree of the first vertex, respectively.

The following m lines denote edges: edge i is represented by a pair of integers v_i, u_i (1 ≤ v_i, u_i ≤ n, u_i ≠ v_i), which are the indices of vertices connected by the edge. There are no loops or multiple edges in the given graph, i. e. for each pair (v_i, u_i) there are no other pairs (v_i, u_i) or (u_i, v_i) in the list of edges, and for each pair (v_i, u_i) the condition v_i ≠ u_i is satisfied.

Output

If there is no spanning tree satisfying the condition from the problem statement, print "NO" in the first line.

Otherwise print "YES" in the first line and then print n-1 lines describing the edges of a spanning tree such that the degree of the first vertex (vertex with label 1 on it) is equal to D. Make sure that the edges of the printed spanning tree form some subset of the input edges (order doesn't matter and edge (v, u) is considered the same as the edge (u, v)).

If there are multiple possible answers, print any of them.

Examples

Input


4 5 1
1 2
1 3
1 4
2 3
3 4


Output


YES
2 1
2 3
3 4


Input


4 5 3
1 2
1 3
1 4
2 3
3 4


Output


YES
1 2
1 3
4 1


Input


4 4 3
1 2
1 4
2 3
3 4


Output


NO

Note

The picture corresponding to the first and second examples: <image>

The picture corresponding to the third example: <image>

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const long double EPS = 1e-9;
const long long M = 1000000007;
void fail() {
  cout << "NO" << endl;
  exit(0);
}
class Graph {
 public:
  vector<vector<int> > a;
  vector<int> vis;
  vector<int> col;
  int n, m, d;
  void addEdge() {
    int l, r;
    cin >> l >> r;
    l--;
    r--;
    a[l].push_back(r);
    a[r].push_back(l);
  }
  Graph() {
    cin >> n >> m >> d;
    a.assign(n, vector<int>());
    vis.assign(n, 0);
    col.assign(n, -1);
    for (int i = 0; i < int(m); i++) addEdge();
  }
  void dfs_dye(int v, int c) {
    col[v] = c;
    for (int i = 0; i < int(a[v].size()); i++) {
      int to = a[v][i];
      if (col[to] != -1) continue;
      dfs_dye(to, c);
    }
  }
  void dfs_out(int v) {
    vis[v] = 1;
    for (int i = 0; i < int(a[v].size()); i++) {
      int to = a[v][i];
      if (vis[to]) continue;
      cout << v + 1 << " " << to + 1 << endl;
      dfs_out(to);
    }
  }
  void solve() {
    int v = 0;
    vis[v] = 1;
    col[v] = 0;
    int c = 1;
    vector<int> v1, v2;
    for (int i = 0; i < int(a[v].size()); i++) {
      int to = a[v][i];
      if (col[to] != -1) {
        v2.push_back(to);
        continue;
      }
      v1.push_back(to);
      dfs_dye(to, c++);
    }
    if (d < v1.size() || d > a[v].size()) fail();
    vector<int> v3;
    cout << "YES" << endl;
    for (int i = 0; i < int(v1.size()); i++) {
      int to = v1[i];
      vis[to] = 1;
      v3.push_back(to);
      cout << v + 1 << " " << to + 1 << endl;
    }
    int num = d - v1.size();
    for (int i = 0; i < int(num); i++) {
      int to = v2[i];
      vis[to] = 1;
      v3.push_back(to);
      cout << v + 1 << " " << to + 1 << endl;
    }
    for (int i = 0; i < int(v3.size()); i++) dfs_out(v3[i]);
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  Graph g;
  g.solve();
}