# coding:utf-8 from collections import Counter as cC S_before = input() N = int(input()) S_after = input() ans = "FAILURE" if cC(S_before) != cC(S_after): ans = "SUCCESS" elif N == 0: if S_before != S_after: ans = "SUCCESS" elif N == 1: if S_after == S_before and S_after[0] == S_after[2] and S_after[0] != S_after[1]: ans = "SUCCESS" if S_before[1] == S_after[1] and S_after[0] != S_before[0]: ans = "SUCCESS" print(ans)