using System; class Magic { static void Main(String[] args) { String Sbefore; long N; String Safter; Sbefore = Console.ReadLine(); N = long.Parse(Console.ReadLine()); Safter = Console.ReadLine(); int cb = CountCoins(Sbefore); int ca = CountCoins(Safter); if(cb != ca) { Console.WriteLine("SUCCESS"); return; } if(cb == 0 || cb == 3) { Console.WriteLine("FAILURE"); return; } if(N >= 2) { Console.WriteLine("FAILURE"); return; } if(N == 1) { if(SwapCmp(Sbefore, Safter)) { Console.WriteLine("FAILURE"); return; } else { Console.WriteLine("SUCCESS"); return; } } if(N == 0) { if(Sbefore == Safter) { Console.WriteLine("FAILURE"); return; } else { Console.WriteLine("SUCCESS"); return; } } } static int CountCoins(String S) { int ret = 0; foreach(char c in S) { if(c == 'o') ret++; } return ret; } static bool SwapCmp(String b, String a) { char[] buff = new char[3]; buff[0] = b[1]; buff[1] = b[0]; buff[2] = b[2]; String s1 = new String(buff); if(s1 == a) return true; buff[0] = b[0]; buff[1] = b[2]; buff[2] = b[1]; String s2 = new String(buff); if(s2 == a) return true; return false; } }