An inversion in an array is a pair of indices (i, j) such that A[i] > A[j] and i < j, but you are given two arrays A and B and  pairs such that A[i] > B[j] and i < j is called Inversion.

If total number of inversions T, is a prime number then the that will be called a MAGIC INVERSION, otherwise it will be a SIMPLE INVERSION.

INPUT

First line contains n denoting the total number of elements, N. The next line contains N space separated integers of array A.. Next line is again N space separated integers of array B.

OUTPUT

Print "MAGIC INVERSION", if total number of inversions T is prime otherwise print "SIMPLE INVERSION".

Constraints:

1 ≤ N ≤ 200000

1 ≤ A[i] ≤ 1000000

1 ≤ B[i] ≤ 1000000

SAMPLE INPUT
3
5 6 7
1 2 3

SAMPLE OUTPUT
MAGIC INVERSION

Explanation

The total number of inversions are 3, which is a prime number.
def isp(n):
	for i in range(2,int(n/2)+1):
		if n%i==0:
			return False
	return True
n=input()
a=map(int,raw_input().split())
b=map(int,raw_input().split())
c=0
i,j=0,0
while i<n-1:
	while i<j+1 and j<n:
		if a[i]>b[j]:
			c+=1
		j+=1
	i+=1
if isp(c):
	print  "MAGIC INVERSION"  
else:
	print "SIMPLE INVERSION"