bef = input() n = int(input()) aft = input() def suc(): print("SUCCESS") def fai(): print("FAILURE") if bef.count("o") != aft.count("o"): suc() elif len(bef) == 1: fai() elif n == 0: if bef != aft: suc() else: fai() else: if bef.count("o") == 1: x = (bef[1] == "o") ^ (aft[1] == "o") if x ^ (n % 2 == 0): fai() else: suc() else: x = (bef[1] == "x") ^ (aft[1] == "x") if x ^ (n % 2 == 0): fai() else: suc()