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.*;
import java.util.*;
import java.lang.*;
import java.math.*;
public final class Main{
    public static StringBuilder str=new StringBuilder("");
    public static int n,m;
    public static int[] element;
    public static int[] arr;
    public static int[] visit;
    public static LinkedList<Integer>[] adj;
    public static final class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner() {
            try {
                br = new BufferedReader(new InputStreamReader(System.in));
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
        public String next() {
            if (st.hasMoreTokens()) return st.nextToken();
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                e.printStackTrace();
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
        public String nextLine() {
            String line = "";
            if (st.hasMoreTokens()) line = st.nextToken();
            else try {
                return br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            while (st.hasMoreTokens()) line += " " + st.nextToken();
            return line;
        }
        public double nextDouble() {
            return Double.parseDouble(next());
        }
    }
    public static final class MathFunction{
        public static long gcd(long a, long b) {
            long var;
            while (a % b > 0) {
                var = b;
                b = a % b;
                a = var;
            }
            return b;
        }
        public static int[] FastradixSort(int[] f)
        {
            int[] to = new int[f.length];
            {
                int[] b = new int[65537];
                for(int i = 0;i < f.length;i++)b[1+(f[i]&0xffff)]++;
                for(int i = 1;i <= 65536;i++)b[i]+=b[i-1];
                for(int i = 0;i < f.length;i++)to[b[f[i]&0xffff]++] = f[i];
                int[] d = f; f = to;to = d;
            }
            {
                int[] b = new int[65537];
                for(int i = 0;i < f.length;i++)b[1+(f[i]>>>16)]++;
                for(int i = 1;i <= 65536;i++)b[i]+=b[i-1];
                for(int i = 0;i < f.length;i++)to[b[f[i]>>>16]++] = f[i];
                int[] d = f; f = to;to = d;
            }
            return f;
        }
        /*public  void Primesieve(int n) {
            for (int i = 0; i < n; i++)
                prime[i] = true;
            for (int p = 2; p * p <= n; p++) {
                if (prime[p] == true) {
                    for (int i = p * p; i <= n; i += p)
                        prime[i] = false;
                }
            }
            */
    }
    public static class Node implements Comparable<Node>{
        int v;
        int deg;
        public Node(int x)
        {
            v=x;
            deg=0;
        }
        public int compareTo(Node b)
        {
            return (b.deg-this.deg);
        }
    }
    public static void main(String args[])
    {
        FastScanner sc=new FastScanner();
        PrintWriter pw=new PrintWriter(System.out);
        int l,x,y,i,j,k,a,D,b;
        n=sc.nextInt();
        m=sc.nextInt();
        D=sc.nextInt();
        element=new int[n];
        adj=new LinkedList[n];
        arr=new int[n];
        visit=new int[n];
        for(i=0;i<n;i++)
        {
            adj[i]=new LinkedList<Integer>();
            arr[i]=0;
            visit[i]=0;
        }
        for(i=0;i<m;i++)
        {
            x=sc.nextInt();
            y=sc.nextInt();
            arr[x-1]++;
            arr[y-1]++;
            adj[x-1].add(y-1);
            adj[y-1].add(x-1);
        }
        visit[0]=1;
        int t=0;
        ArrayList<Integer> list=new ArrayList<Integer>();
        for(int Y:adj[0])
        {
            if(visit[Y]==0)
            {
                t++;
                list.add(Y);
               // System.out.println(Y+"fhdophg");
                dfs(Y,Y);
            }
        }
        if(D<t||D>arr[0])
        {
            System.out.println("NO");
            return;
        }
        for(i=0;i<n;i++)
        {
            visit[i]=0;
        }
        t=0;
        visit[0]=1;
        for(int Y:list)
        {
            visit[Y]=1;
            a=Y+1;
            str.append(1+" "+a+"\n");
            t++;
        }
        for(int Y:adj[0])
        {
            if(visit[Y]==1)
                continue;
            if(t==D)
                break;
            t++;
            visit[Y]=1;
            a=Y+1;
            str.append(1+" "+a+"\n");
        }
        for(int Y:adj[0])
        {
            Dfs(Y);
        }

        System.out.println("YES");
        pw.println(str);
        pw.flush();
        pw.close();
    }
    public static void dfs(int x,int p)
    {
        int a;
        int b;
        visit[x]=1;
        for(int y:adj[x])
        {
            if(visit[y]==0)
            {
                element[y]=p;
                dfs(y,p);
            }
        }
    }
    public static void Dfs(int x)
    {
        int a;
        int b;
        visit[x]=1;
        for(int y:adj[x])
        {
            if(visit[y]==0)
            {
                a=x+1;
                b=y+1;
                str.append(a+" "+b+"\n");
                Dfs(y);
            }
        }
    }
}