# -*- coding:utf-8 -*- if __name__ == "__main__": s_before = raw_input() n = input() s_after = raw_input() a,b = 0,0 for i,j in zip(s_before,s_after): if i == "o": b += 1 if j == "o": a += 1 if a != b: print "SUCCESS" elif (a == 3 and b == 3) or (a == 0 and b == 0): print "FAILURE" else: if n >= 2: print "FAILURE" elif n == 1: if a == 1: d = abs(s_before.index("o") - s_after.index("o")) if d == 1: print "FAILURE" elif d == 0 and s_before.index("o") != 1: print "FAILURE" else: print "SUCCESS" else: d = abs(s_before.index("x") - s_after.index("x")) if d == 1: print "FAILURE" elif d == 0 and s_before.index("x") != 1: print "FAILURE" else: print "SUCCESS" elif n == 0: if s_after == s_before: print "FAILURE" else: print "SUCCESS"