Lonely Island
There are many islands that are connected by one-way bridges, that is, if a bridge connects islands and , then you can only use the bridge to go from to but you cannot travel back by using the same. If you are on island , then you select (uniformly and randomly) one of the islands that are directly reachable from through the one-way bridge and move to that island. You are stuck on an island if you cannot move any further. It is guaranteed that after leaving any island it is not possible to come back to that island.
Find the island that you are most likely to get stuck on. Two islands are considered equally likely if the absolute difference of the probabilities of ending up on them is ≤ .
Input
The first line contains three integers: the number of islands , the number of one-way bridges and the index of the island you are initially on. Each of the next lines contains two integers and representing a one-way bridge from island to .
Output
Print the index of the island that you are most likely to get stuck on. If there are multiple islands,then print them in the increasing order of indices (space separated values in a single line).