s = str(input()) n = int(input()) t = str(input()) if s.count('o') != t.count('o'): print('SUCCESS') exit() if n == 0: if s != t: print('SUCCESS') else: print('FAILURE') elif n == 1: L = [] for i in range(3): if s[i] != t[i]: L.append(i) if L[1]-L[0] == 1: print('FAILURE') else: print('SUCCESS') else: print('FAILURE')