Statement

Given a directed graph G with N vertices and M edges. For each vertex u, you must assign positive integer F(u) such that:  

 For each edge e from a to b, F(b) > F(a) 
 The maximum value m = max( F(u) ) is minimized 


Output the maximum value m. If no such assignment is possible output "IMPOSSIBLE" (quotes for clarity). 

INPUT FORMAT

First line of input contains a number t, the number of test cases. 
Each test case contain starts with two space seperated integers N and M, denoting the number of vertices and the number of edges in the graph respectively. 
Each of the following M lines contain two space seperated integers a b denoting an edge from vertex a to vertex b.  
There can be multiple edges between two vertices a and b. 


OUTPUT FORMAT
For each testcase output the maximum value m or "IMPOSSIBLE" if no assignment is possible.

SAMPLE INPUT

2
2 2
1 2
2 1
3 2
1 2
1 3


SAMPLE OUTPUT

IMPOSSIBLE
2


CONSTRAINTS

t ≤ 20
N ≤ 10000
M ≤ 20000
1 ≤ a,b ≤ N


EXPLANATION

A feasible assignment for the second testcase is: 

Vertex	             Number
1			1
2			2
3			2

So the maximum value is 2
t=input()
for _ in range(t):
	k=map(int,raw_input().split(" "))
	v=[0]*(k[0]+1)
	m,s=0,1
	for i in range(k[1]):
		p=map(int,raw_input().split(" "))
		a,b=p[0],p[1]
		if s:
			if v[a] == 0: v[a] = 1
			if v[b] == 0: v[b] = v[a]+1	
			if v[b] < v[a]: s=0
			if m < v[b]: m=v[b]
	if s == 0:
		print 'IMPOSSIBLE'
	else:
		print m