package yukicoder197; import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner sc=new Scanner(System.in); String str1=sc.next(); int n=sc.nextInt(); String str2=sc.next(); int cntHasCoin1=0; int cntHasCoin2=0; for(int i=0;i<3;i++){ if(str1.charAt(i)=='o'){ cntHasCoin1++; } if(str2.charAt(i)=='o'){ cntHasCoin2++; } } if(cntHasCoin1!=cntHasCoin2){ System.out.println("SUCCESS"); }else if(n==0){ if(str1.equals(str2)){ System.out.println("FAILURE"); }else{ System.out.println("SUCCESS"); } }else if(n==1){ if(str1.charAt(0)==str2.charAt(1)&&str1.charAt(1)==str2.charAt(0)){ System.out.println("FAILURE"); }else if(str1.charAt(1)==str2.charAt(2)&&str1.charAt(2)==str2.charAt(1)){ System.out.println("FAILURE"); }else{ System.out.println("SUCCESS"); } }else if(n>=2){ System.out.println("FAILURE"); }else{ System.err.println("ERROR"); } } }