sb=list(input()) n=int(input()) sa=list(input()) if n==0: if sb!=sa: print('SUCCESS') else: print('FAILURE') exit() if sb.count('o')!=sa.count('o'): print('SUCCESS') exit() if sb.count('o')==0 or sb.count('o')==3: print('FAILURE') exit() if sb.count('o')==1: if sb==['o','x','x']: if (n%2==1 and sa==['x','o','x']) or (n%2==0 and sa==['x','x','o']) or (n%2==0 and sa==['o','x','x']): print('FAILURE') else: print('SUCCESS') elif sb==['x','o','x']: if (n%2==1 and sa==['o','x','x']) or (n%2==1 and sa==['x','x','o']) or (n%2==0 and sa==['x','o','x']): print('FAILURE') else: print('SUCCESS') else: if (n%2==1 and sa==['x','o','x']) or (n%2==0 and sa==['x','x','o']) or (n%2==0 and sa==['o','x','x']): print('FAILURE') else: print('SUCCESS') exit() if sb.count('o')==2: if sb==['o','o','x']: if (n%2==1 and sa==['o','x','o']) or (n%2==0 and sa==['x','o','o']) or (n%2==0 and sa==['o','o','x']): print('FAILURE') else: print('SUCCESS') elif sb==['o','x','o']: if (n%2==1 and sa==['x','o','o']) or (n%2==1 and sa==['o','o','x']) or (n%2==0 and sa==['o','x','o']): print('FAILURE') else: print('SUCCESS') else: if (n%2==1 and sa==['o','x','o']) or (n%2==0 and sa==['o','o','x']) or (n%2==0 and sa==['x','o','o']): print('FAILURE') else: print('SUCCESS')