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.
from sys import stdin
import bisect
def prime_sieve(n=10000000):
	sieve = [True] * n
	for i in xrange(3, int(n** 0.5)+1, 2):
		if sieve[i]:
			sieve[i*i::2*i]=[False]*((n-i*i-1)/(2*i)+1)
	return [2] + [i for i in xrange(3,n,2) if sieve[i]]
def count_inversion(list1, list2):
	list2.sort()
	count=0
	for i in xrange(0, len(list1)):
		index=bisect.bisect_left(list2, list1[i])
		count+=((index-i)-1)
	return count
def main():
	primes = prime_sieve()
	length = stdin.readline()
	A = map(int, stdin.readline().split())
	B = map(int, stdin.readline().split())
	print 'MAGIC INVERSION' if count_inversion(A, B) in primes else 'SIMPLE INVERSION'
if __name__ == '__main__':
	main()