using System; using System.Collections; using System.Collections.Generic; class TEST{ static void Main(){ Sol mySol =new Sol(); mySol.Solve(); } } class Sol{ public void Solve(){ HashSet[] H=new HashSet[4]; for(int i=0;i<4;i++)H[i]=new HashSet(); H[0].Add(S); char[] tmp=new char[3]; tmp[0]=S[0];tmp[1]=S[2];tmp[2]=S[1]; H[1].Add(new String(tmp)); tmp[0]=S[1];tmp[1]=S[0];tmp[2]=S[2]; H[1].Add(new String(tmp)); tmp[0]=S[1];tmp[1]=S[2];tmp[2]=S[0]; H[2].Add(new String(tmp)); tmp[0]=S[2];tmp[1]=S[0];tmp[2]=S[1]; H[2].Add(new String(tmp)); tmp[0]=S[2];tmp[1]=S[1];tmp[2]=S[0]; H[3].Add(new String(tmp)); bool chk=true; if(H[0].Contains(T) && N>=0 && N%2==0)chk=false; if(H[1].Contains(T) && N>=1 && (N-1)%2==0)chk=false; if(H[2].Contains(T) && N>=2 && (N-2)%2==0)chk=false; if(H[3].Contains(T) && N>=3 && (N-3)%2==0)chk=false; Console.WriteLine(chk?"SUCCESS":"FAILURE"); } String S,T; int N; public Sol(){ S=rs(); N=ri(); T=rs(); } static String rs(){return Console.ReadLine();} static int ri(){return int.Parse(Console.ReadLine());} static long rl(){return long.Parse(Console.ReadLine());} static double rd(){return double.Parse(Console.ReadLine());} static String[] rsa(){return Console.ReadLine().Split(' ');} static int[] ria(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));} static long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));} static double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));} }