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

Solution:
###pyrival template for fast IO
import os
import sys
from io import BytesIO, IOBase
# region fastio
BUFSIZE = 8192
class FastIO(IOBase):
    newlines = 0
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

def graph_undirected():
    n,e,d=[int(x) for x in input().split()]
    graph={}    #####adjecancy list using dict
    for i in range(e):
        vertex,neighbour=[int(x) for x in input().split()]
        if vertex in graph:
            graph[vertex].append(neighbour)
        else:
            graph[vertex]=[neighbour]
        if neighbour in graph:     #####for undirected part remove to get directed
            graph[neighbour].append(vertex)
        else:
            graph[neighbour]=[vertex]
    return graph,n,d

###bfs undirected graph(asumming can reach all nodes)
from collections import deque
def bfs(graph,currnode):
    visited=[False for x in range(n+1)]
    stack=deque();
    parent=[0 for x in range(n+1)]
    stack.append(currnode)
    while stack:
        currnode=stack.popleft()
        if visited[currnode]==False:
            visited[currnode]=True

        for neigbour in graph[currnode]:
            if visited[neigbour]==False:
                visited[neigbour]=True
                parent[neigbour]=currnode
                stack.append(neigbour)
    return parent


def bfs1(graph,currnode,visited):
    stack=deque();
    stack.append(currnode)
    while stack:
        currnode=stack.popleft()
        if visited[currnode]==False:
            visited[currnode]=True

        for neigbour in graph[currnode]:
            if visited[neigbour]==False:
                visited[neigbour]=True
                stack.append(neigbour)
    return

graph,n,d=graph_undirected()
def solve():
    if len(graph[1])<d:
        print("NO")
        return

    ##find the nodes which cant be deleted as they make graph disconected
    visited=[False for x in range(n+1)]
    visited[1]=True
    mustchoose=set()
    for node in graph[1]:
        if visited[node]==False:
            mustchoose.add(node)
            bfs1(graph,node,visited)
    if len(mustchoose)>d:
        print("NO")
        return
    garr=[]
    for i in mustchoose:
        garr.append(i)
    for node in graph[1]:
        if len(garr)==d:
            break
        if node not in mustchoose:
            garr.append(node)
    graph[1]=garr
    parent=bfs(graph,1)
    print("YES")
    for i in range(2,len(parent)):
        sys.stdout.write(str(parent[i])+" "+str(i)+"\n")
solve()