# 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 S_before == S_after and N == 1 and S_after[0] == S_after[2] and S_after[0] != S_after[1]: ans = "SUCCESS" elif S_before == S_after: pass elif N == 0: if S_before != S_after: ans = "SUCCESS" elif N == 1: if S_before[1] == S_after[1]: ans = "SUCCESS" print(ans)