import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import random S = list(readline().rstrip()) N = int(readline()) T = list(readline().rstrip()) if N > 4: N = 4 answer = 'SUCCESS' for _ in range(1000): A = S[:] for _ in range(N): i = random.randint(0,1) A[i], A[i+1] = A[i+1], A[i] if A==T: answer = 'FAILURE' break print(answer)