Teleport

Time limit1sMemory limit128 MB

Problem

A spaceship consists of rooms connected by corridors. Each corridor has a travel time, and passing through a room itself takes no time.

Exactly one zero-time teleport connects two different rooms. Lucy made K trips between pairs of different rooms, and each time she traveled in the shortest possible time when both corridors and the teleport were available. For each trip, you are given the starting room, the destination room, and the time the trip took.

Find the two rooms where the teleport is located.

Input

The first line contains two integers N and M, the number of rooms and the number of corridors. 1 <= N <= 200, 1 <= M <= 20000.

Each of the next M lines contains three integers A, B, and T, separated by spaces. This means rooms A and B are connected by a corridor that takes T seconds to traverse.

The next line contains an integer K, the number of trips Lucy recorded. 1 <= K <= 5000.

Each of the next K lines contains three integers A, B, and T, separated by spaces. This means Lucy took T seconds to travel from room A to room B.

A valid answer always exists and is unique.

Output

Print the room numbers of the two rooms where the teleport is located. Print the smaller number first, and separate the two numbers with one space.