S_before = input() N = int(input()) S_after = input() if S_before.count('o') != S_after.count('o'): print('SUCCESS') exit() if N == 1 and (S_before, S_after) in [('oxx', 'xxo'), ('xox', 'xox'), ('xxo', 'oxx'), ('xoo', 'oox'), ('oxo', 'oxo'), ('oox', 'xoo')]: print('SUCCESS') else: print('FAILURE')