eolymp
bolt
Try our new interface for solving problems
Problems

Server hosting

Server hosting

Time limit 1 second
Memory limit 128 MiB

The city has a special computer network that is used for the transmission of information by the military. In connection with frequent rocket attacks, the infrastructure of the country suffered significant damage. Along with this, there were problems with the functioning of the computer network within the city.

Information about the initial structure of the computer network and the time of information transfer between the relevant network nodes is known. It is known that if there is a connection between the nodes, then the information is reached by the most profitable (fast) route.

After the occurrence of network damage, the information transfer time between some nodes decreased.

Determine where you need to place the main server so that the time to transfer information from the server to the most distant (the one to which the information reaches the slowest) node of the network would be minimal.

Input data

The first line contains two natural numbers: n (1n1000) - the number of network nodes and m - the number of communication channels between these nodes .

Each of the following m lines contains information about the number of milliseconds c[i] for information transfer from node a[i] to b[i] in the form of three numbers: a[i] , b[i] and c[i] (1a[i], b[i]n, 1im).

The next line contains the number k (0km) - the number of communication channels in which the speed of information transmission has decreased.

Next, there are k lines, each of which contains information by how much the information transfer time between the corresponding pair of nodes has decreased in the form of three numbers: x[i], y[i] and z[i] (1x[i], y[i]n, 1im), where x[i], y[i] are the numbers of network nodes, and z[i] shows how many milliseconds the information transfer time between nodes x[i] and y[i] has increased.

Output data

Determine the network node where to place the main server, so that the time of information transfer from the server to the most distant (the one to which the information reaches the slowest) network node would be minimal. If the server can be placed in several nodes, then list the numbers of such nodes in ascending order.

Examples

Input example #1
5 7
1 2 10
1 3 19
2 4 21
4 5 9
1 5 16
5 3 22
1 4 34
2
1 2 1
3 5 4
Output example #1
1

Note

The server should be placed in point 1. Then the data transfer time to the most separated node 4 will be 25 milliseconds.

Source ІІ stage of All-Ukrainian informatics olympiad in Zhitomyr region 17.12.2022