using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace foryuki { class Program { static void Main(string[] args) { char[] c1 = Console.ReadLine().ToCharArray(); int N = int.Parse(Console.ReadLine()); char[] c2 = Console.ReadLine().ToCharArray(); int cnt = 0; foreach (var item in c1) { if (item == 'o') cnt++; } foreach (var item in c2) { if (item == 'o') cnt--; } if (cnt != 0) { Console.WriteLine("SUCCESS"); return; } //--------------------------------------------- if (N >= 2) { Console.WriteLine("FAILURE"); return; } //---------------------------------------------- string w1 = ""; string w2 = ""; if (N == 0) { w1 = "" + c1[0] + c1[1] + c1[2]; w2 = "" + c2[0] + c2[1] + c2[2]; if (w1 == w2) { Console.WriteLine("FAILURE"); return; } else { Console.WriteLine("SUCCESS"); return; } } //---------------------------------------------- w1 = "" + c1[1] + c1[0] + c1[2]; w2 = "" + c1[0] + c1[2] + c1[1]; string w3 = "" + c2[0] + c2[1] + c2[2]; if (w3 == w1 || w3 == w2) { Console.WriteLine("FAILURE"); return; } else { Console.WriteLine("SUCCESS"); return; } } //------------------------------------------------------------- static int[] ConvertStringArrayToIntArray(string[] str, int defaultValue) { int[] b = Array.ConvertAll(str, delegate(string value) { return int.Parse(value); }); for (int i = 0; i < b.Length; i++) { b[i] = defaultValue; } return b; } } }