#!/usr/bin/python # -*- coding: utf-8 -*- # † # (ΦωΦ)<頼むぜ! def f(s0, s1, c): if s0[0] == c and s1[2] == c: return 1 if s0[2] == c and s1[0] == c: return 1 if s0[1] == c and s1[1] == c: return 1 return 0 def fushigi(s0, s1, n): s0o = s0.count('o') s1o = s1.count('o') if s0o != s1o: return 1 # コインの数が違ってたらふしぎ! if n == 0: return s0 != s1 # なんもしてないのに違ってたらふしぎ! if n == 1: if s0o == 1: if f(s0, s1, 'o'): return 1 elif s0o == 2: if f(s0, s1, 'x'): return 1 return 0 s0 = raw_input() n = int(raw_input()) s1 = raw_input() if fushigi(s0, s1, n): print 'SUCCESS' else: print 'FAILURE'