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