URI Online Judge | 2118
# What Headquarter?

**Timelimit: 1**

By Thalyson Nepomuceno, Universidade Estadual do Ceará Brazil

In Fortaleza, all students wishing to study in the Farias Brito, but as there are many venues in the city, some students are in doubt about which headquarter to enroll.

A student chooses to study at the nearest headquarter where he lives. If there are headquarters with same distance from where he lives, the student chooses to study at the headquarters that won more medals in Olympics. If still remains a tie, the student chooses the oldest headquarter.

The map Fortress can be drawn as a graph, where the vertices represent the sites, and the edges represent the streets (Connecting two sites). The distance between two sites X and Y is given by the minimum number of streets that must be used to arrive at Y from X.

The big boss Parcelo Mena ordered Nhalyson Tepomuceno to make a program that indicates what the best headquarter for the students.

The input consists of multiple lines. The first line contains four integers **L**, **S**, **Q** (1 ≤ **L**, **S**, **Q** ≤ 10^5) and **A** (1 ≤ **A** ≤ 10^6), representing the number of sites, the number of headquarters, the numbers of students and the number of streets. Each of the next S lines contains three integers **P _{i}**,

It is guaranteed that for any two distinct headquarter, they were not built on the same day.

For each location a student who wishes to enroll in Farias Brito, print the headquarter identifier that the student must enroll. If there is no headquarter that is accessible by the student using the streets, print "Noic".

Input Sample | Output Sample |

3 2 1 2 1 100000 500000 2 100001 499999 1 3 2 3 3 |
2 |