sb = input() n = int(input()) sa = input() if sorted(sb) != sorted(sa): print("SUCCESS") elif n >= 2: print("FAILURE") elif n == 1: ans = set([]) ans.add(sb[0] + sb[2] + sb[1]) ans.add(sb[1] + sb[0] + sb[2]) if sa in ans: print("FAILURE") else: print("SUCCESS") elif sb == sa: print("FAILURE") else: print("SUCCESS")