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