import java.util.Scanner; public class Main { static int[] tatesum,yokosum; public static void main(String[] args){ // TODO 自動生成されたメソッド・スタブ Scanner sc = new Scanner(System.in); String mae = sc.next(); int n = sc.nextInt(); String ato = sc.next(); if(n==0){ if(mae.equals(ato)){ System.out.println("FAILURE"); }else{ System.out.println("SUCCESS"); } }else if(n==1){ StringBuilder a = new StringBuilder(mae); char aa = a.charAt(0); a=a.deleteCharAt(0); a=a.insert(1, aa); StringBuilder b = new StringBuilder(mae); char bb = b.charAt(2); b=b.deleteCharAt(2); b=b.insert(1, bb); if(ato.equals(a.toString()) || ato.equals(b.toString())){ System.out.println("FAILURE"); }else{ System.out.println("SUCCESS"); } }else{ int countmae =0; for(int i=0;i<3;i++){ if(mae.charAt(i)=='o') countmae++; } int countato=0; for(int i=0;i<3;i++){ if(ato.charAt(i)=='o') countato++; } if(countato==countmae){ System.out.println("FAILURE"); }else{ System.out.println("SUCCESS"); } } } }