# coding:utf-8 from collections import Counter as cc import sys 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: 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)