SB = input() N = int(input()) SA = input() if SB.count("x") != SA.count("x"): print("SUCCESS") exit() if N == 0 and SB != SA: print("SUCCESS") exit() if N == 2: print("FAILURE") exit() if N == 1: if SB[0] == SA[2] or SB[2] == SA[0] or SB != "xxx" or SB !="ooo": print("SUCCESS") exit() print("FAILURE")