import java.util.Scanner; public class Yuki197{ public static void main(String[] arg){ Scanner sc = new Scanner(System.in); String b,a; int n,ob=0,xb=0,oa=0,xa=0; b = sc.next(); n = sc.nextInt(); a = sc.next(); for(int i =0;i<3;i++){ if(b.charAt(i) == 'o'){ ob++; }else{ xb++; } if(a.charAt(i) == 'o'){ oa++; }else{ xa++; } } if(ob != oa){ System.out.println("SUCCESS"); }else{ int posb = 0,posa=0; if(n % 2 == 0){ if(ob == 1){ for(int i = 0;i<3;i++){ if(b.charAt(i) == 'o')posb = i; if(a.charAt(i) == 'o')posa = i; } if(Math.abs(posa-posb) % 2 == 0){ System.out.println("FAILURE"); }else{ System.out.println("SUCCESS"); } }else if(ob == 2){ for(int i = 0;i<3;i++){ if(b.charAt(i) == 'x')posb = i; if(a.charAt(i) == 'x')posa = i; } if(Math.abs(posa-posb) % 2 == 0){ System.out.println("FAILURE"); }else{ System.out.println("SUCCESS"); } }else{ System.out.println("FAILURE"); } }else{ if(ob == 1){ for(int i = 0;i<3;i++){ if(b.charAt(i) == 'o')posb = i; if(a.charAt(i) == 'o')posa = i; } if(Math.abs(posa-posb )% 2 == 0){ System.out.println("SUCCESS"); }else{ System.out.println("FAILURE"); } }else if(ob == 2){ for(int i = 0;i<3;i++){ if(b.charAt(i) == 'x')posb = i; if(a.charAt(i) == 'x')posa = i; } if(Math.abs(posa-posb) % 2 == 0){ System.out.println("SUCCESS"); }else{ System.out.println("FAILURE"); } }else{ System.out.println("FAILURE"); } } } } }