Cover the Paths

아직 제출이 없습니다시간 제한1초메모리 제한256 MB

문제

You are given an undirected unweighted tree consisting of nn vertices labeled by integers 11, 22, \ldots, nn. A total of mm simple paths are chosen in this tree. Each path is described as a pair of its endpoints (a_i,b_i)(a\_i, b\_i).

Let VV be the set of all vertices of the tree. We say that subset SS of VV is good if for every ii such that 1im1 \le i \le m, the simple path from a_ia\_i to b_ib\_i contains at least one vertex from SS. We say that subset TT be the best subset if TT is a good subset and there is no good subset XX such that X<T|X| < |T|.

You have to find the best subset of VV.

입력

The first line contains an integer nn, the number of vertices in the tree (1n1051 \le n \le 10^5).

Each of the next n1n - 1 lines describes an edge of the tree. Edge ii is denoted by two integers u_iu\_i and v_iv\_i, the labels of vertices it connects (1u_i,v_in1 \le u\_i, v\_i \le n, u_iv_iu\_i \ne v\_i). It is guaranteed that the given edges form a tree.

The next line contains an integer mm, the number of paths (1m1051 \le m \le 10^5).

Each of the next mm lines describes a path in the tree. Path ii is denoted by two integers a_ia\_i and b_ib\_i, the labels of the endpoints (1a_i,b_in1 \le a\_i, b\_i \le n). For some paths, it may be that a_i=b_ia\_i = b\_i. It is not guaranteed that all paths are pairwise distinct.

출력

On the first line, print the size of the best subset of VV. On the second line, print the labels of vertices belonging to the best subset of VV in any order.

If there are several possible solutions, print any one of them.