def chk(sa,sb,N): if sa.count('o')!=sb.count('o'): return 0 if sa[1]==sb[1] and N<2: return 0 return 1 sa=input() N = int(input()) sb=input() print(["SUCCESS","FAILURE"][chk(sa,sb,N)])