sb=raw_input() n=int(raw_input()) sa=raw_input() if n == 0 and sb.count("o") != sa.count("o"): print("SUCCESS") elif n== 0 and (sb.count("o") == sa.count("o")): print("FAILURE") elif n == 1: if sb[1] in "o" and sa[1] in "o": if ("o" in sb[0] and "o" in sa[2]) or ("o" in sb[2] and "o" in sa[0]): print("FAILURE") else: print("SUCCESS") elif sb.count("o") != sa.count("o"): print("SUCCESS") else: if sb.count("o") == sa.count("o") and sb == sa: print("FAILURE") elif sb.count("o") == sa.count("o") and sb != sa: print("FAILURE") else: print("SUCCESS") elif n >= 2 and (sb.count("o") == sa.count("o")): print("FAILURE") else: print("SUCCESS")