import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) { BufferedReader stdReader =new BufferedReader(new InputStreamReader(System.in)); try { String line1 = stdReader.readLine(); int n = Integer.parseInt(stdReader.readLine()); String line2 = stdReader.readLine(); int num1 = 0; int num2 = 0; for(int i=0;i<3;i++){ if(line1.charAt(i) == 'o') num1++; if(line2.charAt(i) == 'o') num2++; } if(num1 != num2){ System.out.println("SUCCESS"); return; } if(line1.equals(line2)){ }else if((line1.charAt(0)==line2.charAt(2))&&n>=2){ System.out.println("FAILURE"); }else if((line1.charAt(0)!=line2.charAt(1)||line1.charAt(1)!=line2.charAt(2))&&n>=1){ System.out.println("FAILURE"); }else System.out.println("SUCCESS"); } catch (IOException e) { e.printStackTrace(); } } }