Spontaneous Trip

Given flight counts between airports, find the most likely airport reached after exactly K random flights starting from ICN.

Medium5ProbabilityDynamic programmingGraphNo attempts yetTime limit3sMemory limit256 MB

Problem

Sangil travels on impulse. One journey goes like this.

  1. He goes to the airport of the city he is in.
  2. He buys a ticket for one of the flights leaving that airport, picked at random. Every flight leaving the airport is equally likely.
  3. He boards that flight and lands in another city.

One trip consists of exactly KK journeys, and it always starts at the airport ICN. Some airports have no departing flight at all, so a trip that reaches one of them cannot continue.

A course is the sequence of airports Sangil passes through during the KK journeys. The probability of a course is the product of the probabilities of the flights picked in each journey. Among the courses that finish all KK journeys, find the last airport of the course with the highest probability. Such a course always exists.

Input

The first line contains the number of test cases TT (1T101 \le T \le 10).

The first line of each test case contains the number of airports NN and the number of journeys in one trip KK (2N1002 \le N \le 100, 1K10001 \le K \le 1000).

Each of the next NN lines contains the IATA code of one airport. A code consists of three uppercase letters, the codes are pairwise different, and one of them is ICN.

Each of the next NN lines contains NN integers. The jj-th integer on the ii-th line, SijS_{ij}, is the number of flights that leave airport ii and land at airport jj (0Sij1000 \le S_{ij} \le 100, Sii=0S_{ii} = 0). Airport ii has Si1+Si2++SiNS_{i1} + S_{i2} + \dots + S_{iN} departing flights in total, so the probability that Sangil flies from airport ii to airport jj is SijS_{ij} divided by that sum.

Output

For each test case, print the IATA code of the last airport of the most likely course on its own line. If several most likely courses end at different airports, print the code that comes first in alphabetical order.