for tc in range(int(raw_input())):
	n=int(raw_input())
	a=map(int,raw_input().split())
	flag=1
	for i in range(n):
		if a[a[i]-1]!=i+1:
			flag=0
			break
	if flag==0:
		print 'not inverse'
	else:
		print 'inverse'