sb=raw_input() n=int(raw_input()) sa=raw_input() c=0 if n == 0 and (sb.count("x") != sa.count("x")) or (sb.count("o") != sa.count("o")): print("SUCCESS") elif n == 1: if ("o" in sb[2] and "o" in sa[0]) or ("o" in sb[0] and "o" in sa[2]): if ("o" in sb[1]) and ("o" in sa[1]): if ("o" in sb[0] and "o" in sa[2]) or ("o" in sb[2] and "o" in sa[2]): print("FAILURE") else: print("SUCCESS") else: for i in range(0,3): if sb[i] == sa[i]: c+=1 if c == 3: print("FAILURE") else: print("FAILURE")