import java.util.Scanner; public class Yuki197{ public static void main(String[] arg){ Scanner sc = new Scanner(System.in); String be,af; int n,bo=0,ao=0,posb=0,posa=0; be = sc.next(); n = sc.nextInt(); af = sc.next(); if(n == 0){ if(be == af){ System.out.println("FAILURE"); }else{ System.out.println("SUCCESS"); } }else if(n == 1){ for(int i = 0;i<3;i++){ if(be.charAt(i) == 'o')bo++; if(af.charAt(i) =='o')ao++; } if(ao != bo){ System.out.println("SUCCESS"); }else{ if(ao == 1){ for(int i = 0;i<3;i++){ if(be.charAt(i) == 'o')posb = i; if(af.charAt(i) == 'o')posa = i; } if(posb+posa != 2){ System.out.println("FAILURE"); }else{ System.out.println("SUCCESS"); } }else if(ao == 2){ for(int i = 0;i<3;i++){ if(be.charAt(i) != 'o')posb = i; if(af.charAt(i) != 'o')posa = i; } if(posb+posa != 2){ System.out.println("FAILURE"); }else{ System.out.println("SUCCESS"); } }else{ System.out.println("FAILURE"); } } }else{ System.out.println("FAILURE"); } } }