before = list(raw_input()) N = input() after = list(raw_input()) count = 0 for i in range(3): if before[i] != after[i]: count+=1 if count <= N and before.count('o') == after.count('o'): print 'FAILURE' else: print 'SUCCESS'