The Party That Never Ends

No attempts yetTime limit2sMemory limit256 MB

Problem

Minho loves parties, so he built an amusement park called "Minho World" where a party is always going on. It started as a small park with a single party hall, but as more people came he kept adding halls, and the park now has N of them. Every time Minho built a new hall he paved roads connecting it directly with every hall that already existed, and all of those roads are one way. So there is exactly one direct road from any hall i to any other hall j.

Once the park grew, two problems appeared.

  1. Even when a direct road runs from hall A to hall B, going through some other hall can be faster.
  2. A new party starts in hall B exactly C units of time from now, and because of the first problem it is not obvious whether a guest standing in hall A can get there in time.

Write the program Minho needs: for each request, decide whether a guest can travel from hall A to hall B in at most C units of time. Arriving at exactly time C counts as arriving in time.

Input

The first line has the number of party halls N (5 ≤ N ≤ 500) and the number of guests who sent a request M (1 ≤ M ≤ 10,000). The halls are numbered 1 to N.

Each of the next N lines has N numbers. The j-th number T on the i-th line is the time it takes to travel the direct road from hall i to hall j. If i and j differ then 1 ≤ T ≤ 1,000,000, and if i equals j then T is 0.

Each of the next M lines has three integers A, B, C. A (1 ≤ A ≤ N) is the hall the guest is in, B (1 ≤ B ≤ N) is the hall where the next party starts, and C (1 ≤ C ≤ 1,000,000,000) is the time left until that party starts.

Output

Handle the M requests in the order they are given and print one line for each. Print "Enjoy other party" if the shortest travel time from hall A to hall B is at most C, and "Stay here" otherwise.