This is a simple game you must have played around with during your school days, calculating FLAMES of you and your crush! Given the names of two people, cancel out the common letters (repeated occurrence of a letter is treated separately, so 2A's in one name and one A in the other would cancel one A in each name), count the total number of remaining letters (n) and repeatedly cut the letter in the word FLAMES which hits at the nth number when we count from F in cyclic manner.
For example:
NAME 1: SHILPA
NAME 2: AAMIR
After cutting the common letters: 
NAME 1: SHILPA 
NAME 2: AAMIR
Total number of letters left=7
FLAMES, start counting from F : 1=F, 2=L, 3=A, 4=M, 5=E, 6=S,7=F...So cut F
FLAMES: repeat this process with remaining letters of FLAMES for number 7 (start count from the letter after 
the last letter cut) . In the end, one letter remains. Print the result corresponding to the last letter:
F=FRIENDS
L=LOVE
A=ADORE
M=MARRIAGE
E=ENEMIES
S=SISTER
-----Input-----
The no. of test cases (<100)
two names (may include spaces) for each test case.
-----Output-----
FLAMES result (Friends/Love/...etc) for each test case
-----Example-----
Input:
2
SHILPA
AAMIR
MATT
DENISE
Output:
ENEMIES
LOVE
By:
Chintan, Asad, Ashayam, Akanksha
import sys

alpha='abcdefghijklmnopqrstuvwxyz'

for _ in range(int(sys.stdin.readline())):
    n1=sys.stdin.readline().strip().lower().replace(' ','')
    n2=sys.stdin.readline().strip().lower().replace(' ','')
    
    common=[0 for i in range(26)]
    
    for i in range(26):
        t1=n1.count(alpha[i])
        t2=n2.count(alpha[i])
        
        if t1==t2:
            common[i]=t1
        else:
            common[i]=min([t1,t2])
            
    for a in range(26):
        n1=n1.replace(alpha[a],'',common[a])
        n2=n2.replace(alpha[a],'',common[a])
        
    remain=len(n1)+len(n2)
    
    f=['f','l','a','m','e','s']
    index=0
    while len(f)>1 and remain!=0:
    
        l=remain%len(f)-1

        del f [l]
        
        if l!=0 and l!=-1:
            f=f[l:]+f[:l]
        
    if f[0]=='f'and remain!=0:
        print('FRIENDS')
    elif f[0]=='l':
        print('LOVE')
    elif f[0]=='a':
        print('ADORE')
    elif f[0]=='m':
        print('MARRIAGE')
    elif f[0]=='e':
        print('ENEMIES')
    elif f[0]=='s':
        print('SISTER')
    elif remain==0:
        print('SISTER')
import sys

alpha='abcdefghijklmnopqrstuvwxyz'

for _ in range(int(sys.stdin.readline())):
    n1=sys.stdin.readline().strip().lower().replace(' ','')
    n2=sys.stdin.readline().strip().lower().replace(' ','')
    
    common=[0 for i in range(26)]
    
    for i in range(26):
        t1=n1.count(alpha[i])
        t2=n2.count(alpha[i])
        
        if t1==t2:
            common[i]=t1
        else:
            common[i]=min([t1,t2])
            
    for a in range(26):
        n1=n1.replace(alpha[a],'',common[a])
        n2=n2.replace(alpha[a],'',common[a])
        
    remain=len(n1)+len(n2)
    
    f=['f','l','a','m','e','s']
    index=0
    while len(f)>1 and remain!=0:
    
        l=remain%len(f)-1

        del f [l]
        
        if l!=0 and l!=-1:
            f=f[l:]+f[:l]
        
    if f[0]=='f'and remain!=0:
        print('FRIENDS')
    elif f[0]=='l':
        print('LOVE')
    elif f[0]=='a':
        print('ADORE')
    elif f[0]=='m':
        print('MARRIAGE')
    elif f[0]=='e':
        print('ENEMIES')
    elif f[0]=='s':
        print('SISTER')
    elif remain==0:
        print('SISTER')