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 choose at most ⌊n/2⌋ vertices in this graph so each unchosen vertex is adjacent (in other words, connected by an edge) to at least one of chosen vertices.

It is guaranteed that the answer exists. If there are multiple answers, you can print any.

You will be given multiple independent queries to answer.

Input

The first line contains a single integer t (1 ≤ t ≤ 2 ⋅ 10^5) — the number of queries.

Then t queries follow.

The first line of each query contains two integers n and m (2 ≤ n ≤ 2 ⋅ 10^5, n - 1 ≤ m ≤ min(2 ⋅ 10^5, (n(n-1))/(2))) — the number of vertices and the number of edges, 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 self-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. It is guaranteed that the given graph is connected.

It is guaranteed that ∑ m ≤ 2 ⋅ 10^5 over all queries.

Output

For each query print two lines.

In the first line print k (1 ≤ ⌊n/2⌋) — the number of chosen vertices.

In the second line print k distinct integers c_1, c_2, ..., c_k in any order, where c_i is the index of the i-th chosen vertex.

It is guaranteed that the answer exists. If there are multiple answers, you can print any.

Example

Input


2
4 6
1 2
1 3
1 4
2 3
2 4
3 4
6 8
2 5
5 4
4 3
4 1
1 3
2 3
2 6
5 6


Output


2
1 3
3
4 3 6

Note

In the first query any vertex or any pair of vertices will suffice.

<image>

Note that you don't have to minimize the number of chosen vertices. In the second query two vertices can be enough (vertices 2 and 4) but three is also ok.

<image>

Solution (in JAVA):

Solution:
//package math_codet;

import java.io.*;
import java.util.*;
 
public class lets_do {
    FastReader in;
    PrintWriter out;
    Helper_class h;
    final long mod = 1000000007;
    final int MAXN = 300005;
    final int lgN = 20;
    final int INF = (int)1e14;
    public static void main(String[] args) throws java.lang.Exception{
        new lets_do().run();
    }
    void run() throws Exception{
        in=new FastReader(System.in);
        out = new PrintWriter(System.out);
        h = new Helper_class();
        int t = 1;
        while(t-->0)
            solve();
        out.flush();
        out.close();
    }
    void solve(){
        int n = h.ni();
        int m = h.ni();
        Edge[] arr = new Edge[m];
        ArrayList<Integer>[] graph = new ArrayList[n];
        int i = 0;
        int[] deg = new int[n];
        for(i = 0; i < n; i++)
        	graph[i] = new ArrayList<Integer>();
        int[][] edges = new int[m][2];
        for(i = 0; i < m; i++){
            int x = h.ni() - 1;
            int y = h.ni() - 1;
            deg[x]++;
            deg[y]++;
            edges[i][0] = x;
            edges[i][1] = y;
            graph[x].add(y);
            graph[y].add(x);
        }
        for(i = 0; i < m; i++)
            arr[i] = new Edge(edges[i][0], edges[i][1], Math.max(deg[edges[i][0]], deg[edges[i][1]]));
        Arrays.sort(arr, com1);
        DSU ob = new DSU(n);
        int max = 0, ind = -1;
        for(i = 0; i < n; i++) {
        	if(max < deg[i]) {
        		max = deg[i];
        		ind = i;
        	}
        }
        //h.pn(ind);
        for(int u : graph[ind]) {
        	h.pn((ind + 1) +" "+(u + 1));
        	ob.unite(u, ind);
        }
        for(i = 0; i < m; i++){
            int uu = arr[i].u;
            int vv = arr[i].v;
            if(ob.find(uu) != ob.find(vv)){
                ob.unite(uu, vv);
                h.pn((uu + 1) +" "+(vv + 1));
            }
        }
    }
    class DSU{
        int[] rank, parent;
        public DSU(int n){
            rank = new int[n];
            parent = new int[n];
            make_set(n);
        }
        void make_set(int n){
            int i = 0;
            for(i = 0; i < n; i++)
                parent[i] = i;
        }
 
        int find(int x){
            if (parent[x] != x)
                parent[x] = find(parent[x]);
            return parent[x];
        }
 
        void unite(int x, int y){
            int xRoot = find(x), yRoot = find(y);
            if (xRoot == yRoot)
                return;
            if (rank[xRoot] < rank[yRoot])
                parent[xRoot] = yRoot;
            else if (rank[yRoot] < rank[xRoot])
                parent[yRoot] = xRoot;
            else{
                parent[yRoot] = xRoot;
                rank[xRoot] = rank[xRoot] + 1;
            }
        }
    }
    
    static final Comparator<Pair> com = new Comparator<Pair>(){
        public int compare(Pair a, Pair b){
            if(Integer.compare(a.y, b.y) != 0)
                return Integer.compare(a.y, b.y);
            else
                return Integer.compare(a.x, b.x);
        }
    };
    static final Comparator<Edge> com1 = new Comparator<Edge>(){
        public int compare(Edge a, Edge b){
            if(Integer.compare(b.wt, a.wt) != 0)
                return Integer.compare(b.wt, a.wt);
            else if(Integer.compare(a.u, b.u) != 0)
                return Integer.compare(a.u, b.u);
            else
                return Integer.compare(a.u, b.u);
        }
    };
    class Pair{
        int x;
        int y;
        Pair(int p, int q){
            y = p;
            x = q;
        }
    }
    class Edge{
        int u , v, wt;
        Edge(int a, int b, int w){
            u = a;
            v = b;
            wt = w;
        }
        int other(int x) {
            return u ^ v ^ x;
        }
    }
    class Helper_class{
        long gcd(long a, long b){return (b==0)?a:gcd(b,a%b);}
        int gcd(int a, int b){return (b==0)?a:gcd(b,a%b);}
        int bitcount(long n){return (n==0)?0:(1+bitcount(n&(n-1)));}
        void p(Object o){out.print(o);}
        void pn(Object o){out.println(o);}
        void pni(Object o){out.println(o);out.flush();}
        String n(){return in.next();}
        String nln(){return in.nextLine();}
        int ni(){return Integer.parseInt(in.next());}
        long nl(){return Long.parseLong(in.next());}
        double nd(){return Double.parseDouble(in.next());}
 
        long mul(long a,long b){
            if(a>=mod)a%=mod;
            if(b>=mod)b%=mod;
            a*=b;
            if(a>=mod)a%=mod;
            return a;
        }
        long modPow(long a, long p){
            long o = 1;
            while(p>0){
                if((p&1)==1)o = mul(o,a);
                a = mul(a,a);
                p>>=1;
            }
            return o;
        }
        long add(long a, long b){
            if(a>=mod)a%=mod;
            if(b>=mod)b%=mod;
            if(b<0)b+=mod;
            a+=b;
            if(a>=mod)a-=mod;
            return a;
        }
    }
 
    class FastReader{
        private InputStream stream; 
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
 
        public FastReader(InputStream stream) {
            this.stream = stream;
        }
 
        public int read() {
            if (numChars == -1)
                throw new UnknownError();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new UnknownError();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }
 
        public int peek() {
            if (numChars == -1)
                return -1;
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    return -1;
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar];
        }
 
        public void skip(int x) {
            while (x-- > 0)
                read();
        }
 
        public int nextInt() {
            return Integer.parseInt(next());
        }
 
        public long nextLong() {
            return Long.parseLong(next());
        }
 
        public String nextString() {
            return next();
        }
 
        public String next() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuffer res = new StringBuffer();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
 
            return res.toString();
        }
 
        public String nextLine() {
            StringBuffer buf = new StringBuffer();
            int c = read();
            while (c != '\n' && c != -1) {
                if (c != '\r')
                    buf.appendCodePoint(c);
                c = read();
            }
            return buf.toString();
        }
 
        public double nextDouble() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }
 
        public boolean hasNext() {
            int value;
            while (isSpaceChar(value = peek()) && value != -1)
                read();
            return value != -1;
        }
 
        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }
    }
}