Sb=raw_input() N=int(raw_input()) Sa=raw_input() nb=0 na=0 for s in Sb: if s =='x': nb+=1 for s in Sa: if s=='x': na+=1 if nb!=na: print "SUCCESS" exit() if N==0 and Sb!=Sa: print "SUCCESS" exit() if N==0 and Sb==Sa: print "FAILURE" exit() if nb==0: print "FAILURE" exit() if nb==3: print "FAILURE" exit() if nb==1: pb=0 pa=0 for i in range(3): if Sb[i]=='x': pb=i if Sa[i]=='x': pa=i if abs(pa-pb)%2==N%2: print "FAILURE" else: if (pb!=1 and N>=abs(pa-pb)) or (pb==1 and N>=2): print "FAILURE" else: print "SUCCESS" if nb==2: pb=0 pa=0 for i in range(3): if Sb[i]=='o': pb=i if Sa[i]=='o': pa=i if abs(pa-pb)%2==N%2: print "FAILURE" else: if (pb!=1 and N>=abs(pa-pb)) or (pb==1 and N>=2): print "FAILURE" else: print "SUCCESS"