sb = input() N = int(input()) sa = input() def solve(): sb_o = sb.count('o') sa_o = sa.count('o') if sb == sa and N % 2 == 0: return False if sb_o != sa_o: return True if sb_o == 1: return abs(sb.find('o')-sa.find('o')) > N else: return abs(sb.find('x')-sa.find('x')) > N print('SUCCESS' if solve() else 'FAILURE')