bef = list(input()) n = int(input()) aft = list(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() elif n == 1: ng = False bef[0], bef[1] = bef[1], bef[0] if bef == aft: ng = True bef[0], bef[1] = bef[1], bef[0] bef[2], bef[1] = bef[1], bef[2] if bef == aft: ng = True if ng: fai() else: suc() else: fai()