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