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 JAVA):

Solution:
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.BitSet;
import java.util.HashSet;
import java.util.LinkedList;


public class CF544F2 {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] split = br.readLine().split(" ");
		int n = Integer.parseInt(split[0]);
		int k = Integer.parseInt(split[1]);
		int d = Integer.parseInt(split[2]);
		ArrayList<Integer>[] e = new ArrayList[n];
		ArrayList<Integer>[] e2 = new ArrayList[n];
		HashSet<Integer> v1Next = new HashSet<>();
		for(int i=0; i<n; i++) {
			e[i] = new ArrayList<>();
			e2[i] = new ArrayList<>();
		}
		while(k-->0){
			split = br.readLine().split(" ");
			int l = Integer.parseInt(split[0])-1;
			int r = Integer.parseInt(split[1])-1;
			e[l].add(r);
			e[r].add(l);
			if(l!=0 && r!=0){
				e2[l].add(r);
				e2[r].add(l);
			} else {
				if(l==0) v1Next.add(r);
				else v1Next.add(l);
			}
		}
		int cc = 0;
		HashSet<Integer> ccReps = new HashSet<>();
		BitSet visited = new BitSet();
		for(int i=1; i<n; i++)
			if(!visited.get(i)){
				visited.set(i);
				LinkedList<Integer> q = new LinkedList<>();
				q.add(i);
				int rep = -1;
				while(!q.isEmpty()){
					int cur = q.poll();
					if(rep==-1 && v1Next.contains(cur)) rep = cur;
					for(int next: e2[cur])
						if(!visited.get(next)){
							visited.set(next);
							q.add(next);
						}
				}
				cc++;
				ccReps.add(rep);
			}
		if(e[0].size()<d || cc>d) System.out.println("NO");
		else {
			System.out.println("YES");
			visited = new BitSet();
			visited.set(0);
			LinkedList<Integer> q = new LinkedList<>();
			StringBuilder sb = new StringBuilder();
			for(int h : ccReps){
				q.add(h);
				visited.set(h);
				sb.append("1 ").append(h+1).append("\n");
			}
			for(int i=0; cc<d && i<e[0].size(); i++)
				if(!ccReps.contains(e[0].get(i))){
					visited.set(e[0].get(i));
					q.add(e[0].get(i));
					sb.append("1 ").append(e[0].get(i)+1).append("\n");
					cc++;
				}
			while(!q.isEmpty()){
				int cur = q.poll();
				for(int next : e[cur])
					if(!visited.get(next)){
						visited.set(next);
						q.add(next);
						sb.append(cur+1).append(" ").append(next+1).append("\n");
					}
			}
			System.out.print(sb);
		}
	}
}