S_b = [c for c in input()] N = int(input()) S_a = [c for c in input()] if S_b == S_a: print('FAILURE') exit() if S_b.count('o') != S_a.count('o'): print('SUCCESS') exit() t = 'o' if S_b.count(t) == 2: t = 'x' if N == 0: if S_b != S_a: print('SUCCESS') else: print('FAILURE') elif N == 1: if abs(S_b.index(t) - S_a.index(t)) != 1: print('SUCCESS') else: print('FAILURE') else: if (N - abs(S_b.index(t) - S_a.index(t))) % 2 == 0: print('SUCCESS') else: print('FAILURE')