# coding: utf-8 import array, bisect, collections, heapq, itertools, math, random, re, string, sys, time sys.setrecursionlimit(10 ** 7) INF = 10 ** 20 MOD = 10 ** 9 + 7 def II(): return int(input()) def ILI(): return list(map(int, input().split())) def IAI(LINE): return [ILI() for __ in range(LINE)] def IDI(): return {key: value for key, value in ILI()} def solve(S_bef, N, S_aft): bef_list = list(S_bef) aft_list = list(S_aft) bef_count = 0 aft_count = 0 for bef, aft in zip(bef_list, aft_list): if bef == "o": bef_count += 1 if aft == "o": aft_count += 1 if bef_count != aft_count: return "SUCCESS" else: if N == 0: if S_bef == S_aft: return "FAILURE" else: return "SUCCESS" elif N == 1: if bef_count == 1: if S_bef == "oxx" and S_aft == "xxo": return "SUCCESS" elif S_bef == "xox" and S_aft == "xox": return "SUCCESS" elif S_bef == "xxo" and S_aft == "oxx": return "SUCCESS" elif bef_count == 2: if S_bef == "xoo" and S_aft == "oox": return "SUCCESS" elif S_bef == "oxo" and S_aft == "oxo": return "SUCCESS" elif S_bef == "oox" and S_aft == "xoo": return "SUCCESS" else: return "FAILURE" return "FAILURE" def main(): S_bef = input() N = II() S_aft = input() print(solve(S_bef, N, S_aft)) if __name__ == "__main__": main()