import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner koko = new Scanner(System.in); String st = koko.next(); long n = koko.nextLong(); String end = koko.next(); int stm = 0; int stb = 0; int enm = 0; int enb = 0; for(int i=0; i<3; i++){ if(st.charAt(i)=='o'){ stm++; }else{ stb++; } if(end.charAt(i)=='o'){ enm++; }else{ enb++; } } if(stb==enb&&stm==enm){ if(st.equals("oox")){ if(n==0&&!end.equals("oox")){ System.out.println("SUCCESS"); }else if(n==1&&end.equals("xoo")){ System.out.println("SUCCESS"); }else{ System.out.println("FAILURE"); } }else if(st.equals("xoo")){ if(n==0&&!end.equals("xoo")){ System.out.println("SUCCESS"); }else if(n==1&&end.equals("oox")){ System.out.println("SUCCESS"); }else{ System.out.println("FAILURE"); } }else if(st.equals("oxo")){ if(n==0&&!end.equals("oxo")){ System.out.println("SUCCESS"); }else if(n==1&&end.equals("oxo")){ System.out.println("SUCCESS"); }else{ System.out.println("FAILURE"); } }else if(st.equals("xxo")){ if(n==0&&!end.equals("xxo")){ System.out.println("SUCCESS"); }else if(n==1&&end.equals("oxx")){ System.out.println("SUCCESS"); }else{ System.out.println("FAILURE"); } }else if(st.equals("oxx")){ if(n==0&&!end.equals("oxx")){ System.out.println("SUCCESS"); }else if(n==1&&end.equals("xxo")){ System.out.println("SUCCESS"); }else{ System.out.println("FAILURE"); } }else if(st.equals("xox")){ if(n==0&&!end.equals("xox")){ System.out.println("SUCCESS"); }else if(n==1&&end.equals("xox")){ System.out.println("SUCCESS"); }else{ System.out.println("FAILURE"); } }else if(st.equals("xxx")||st.equals("ooo")){ System.out.println("FAILURE"); } }else{ System.out.println("SUCCESS"); } } }