#coding: utf-8 ##yuki_197 sb=raw_input() n=int(raw_input()) sa=raw_input() if sb.count('o')!=sa.count('o'): res=False elif n>=2: res=True elif n==0: if sb==sa: res=True else: res=False elif n==1: if sb=="oxx" and sa=="xxo": res=False elif sb=="xxo" and sa=="oxx": res=False elif sb=="oox" and sa=="xoo": res=False elif sb=="xoo" and sa=="oox": res=False elif sb=="oxo" and sa=="oxo": res=False elif sb=="xox" and sa=="xox": res=False else: res=True if res==True: print "FAILURE" else: print "SUCCESS"