def possible(s, t, n): if s.count('o') != t.count('o'): return False if s.count('o') > 1: s = s.translate(str.maketrans('ox', 'xo')) t = t.translate(str.maketrans('ox', 'xo')) if s.count('o') == 0: return s == t # s.count('o') == 1 if n == 1: return not (s[1] == t[1] == 'o' or s == t[::-1]) else: return True s = input() n = int(input()) t = input() print('FAILURE' if possible(s, t, n) else 'SUCCESS')