The nearest convenience store

Given an undirected weighted graph with some vertices marked as homes and others as stores, pick the home whose shortest-path distance to the nearest store is smallest, breaking ties by vertex number.

Medium4GraphShortest pathHeapDynamic programmingInterviewNo attempts yetTime limit2sMemory limit512 MB

Problem

Yeongseon is looking for a new home. She lives alone and eats at a convenience store on most days, so she wants the home whose distance to a convenience store is the smallest.

The city is given as vertices and edges. Every home candidate and every convenience store sits on a vertex. The distance of a home candidate is the length of the shortest path from that candidate to the nearest convenience store.

Yeongseon is busy preparing for a camp she teaches at, so pick the home for her. If several candidates have the same distance, pick the one with the smallest vertex number.

Input

The first line contains the number of vertices nn and the number of edges mm. (2n50002 \le n \le 5000, 1m1000001 \le m \le 100000)

Each of the next mm lines contains aa, bb and cc, which means the edge joining vertex aa and vertex bb has length cc. (1a,bn1 \le a, b \le n, 1c100001 \le c \le 10000) Several edges may join the same pair of vertices, and an edge may have aa equal to bb. Edges have no direction.

The next line contains the number of home candidates pp and the number of convenience stores qq. (1p1 \le p, 1q1 \le q, 2p+qn2 \le p + q \le n)

The next line contains the pp vertex numbers of the home candidates, and the line after that contains the qq vertex numbers of the convenience stores. No number appears twice on the same line, and no vertex is both a home candidate and a convenience store.

A home candidate may be unable to reach any convenience store. Such a candidate is never picked. At least one home candidate can reach a convenience store.

Output

Print, on one line, the vertex number of the home candidate whose distance to a convenience store is the smallest. If several candidates have the same distance, print the smallest vertex number.