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.
n=input()
if n>=1 and n<=200000:
    A=[]
    B=[]
    k=0
    c=0
    s1=raw_input().split();
    s2=raw_input().split();
    A.append((s1))
    A.append((s2))
    for i in range(0,2):
        for j in range(0,n):
            if int(A[i][j])<1 or int(A[i][j])>1000000:
                k=1
            else:
                B.append(int(A[i][j]))
    if k==0:
    	    chk=0
            B.sort()
            c=B.index(int(s1[0]))
            if c>2:
                if c%2==0:
                    print("SIMPLE INVERSION")
                else:
                    for i2 in range(2,c):
                        if c%i2==0:
                            chk=1
                    if chk==0:
                        print("MAGIC INVERSION")
                    else:
                    	print("SIMPLE INVERSION")
            elif c==2:
                print("MAGIC INVERSION")
            elif c==1:
                 print("SIMPLE INVERSION")