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.deleteCharAt(0); a.insert(0, aa); StringBuilder b = new StringBuilder(mae); char bb = b.charAt(0); b.deleteCharAt(0); b.insert(0, bb); if(mae.equals(a.toString()) || mae.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"); } } } }