FPLAN - Field Plan

no tags 

World Soccer Championship is coming soon and coach Yogi wants to prepare his team as well as possible. So he made up a strategy field plan for every player of the team. One plan describes a number of possible locations for the player on the field. Moreover, if Yogi wants the player to be able to move from one location A to another location B then the plan specifies the ordered pair (A,B). He is sure that his team will win if the players run over the field from one location to another using only moves of the plan.

example image

Yogi tells every player to follow his plan and to start from a location that reaches every other location on the plan (by possibly multiple moves). However, it is quite difficult for some soccer players, simple minded as they are, to find a suitable starting location. Can you help every player to figure out the set of possible start locations?

Input

The first line gives the number of field plans. The input contains at most eleven field plans (what else?). Every plan starts with a line of two integers N and M, with 1 ≤ N ≤ 100000 and 1 ≤ M ≤ 100000, giving the number of locations and the number of moves. In the following M lines a plan specifies moves (A,B) by two white space separated integers 0 ≤ A,B < N. The plans are separated by a blank line.

Output

For every plan print out all possible starting locations, sorted increasingly and one per line. If there are no possible locations to start, print Confused. Print a blank line after each plan output.

Example

Input:
2
4 4
0 1
1 2
2 0
2 3

4 4
0 3
1 0
2 0
2 3

Output:
0
1
2

Confused


hide comments
Ravi Kiran: 2011-07-20 06:34:48

CAPCITY is very "close" to this problem. :-)


Added by:Adrian Kuegel
Date:2010-06-21
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: NODEJS OBJC PERL6 SQLITE VB.NET
Resource:German Collegiate Programming Contest 2010 (Author: Christian Hundt)