import java.util.Scanner; public class Main_yukicoder197 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); char[] be = sc.next().toCharArray(); int n = sc.nextInt(); char[] af = sc.next().toCharArray(); int bcnt = 0; int acnt = 0; for (int i = 0; i < 3; i++) { if (be[i] == 'o') { bcnt++; } if (af[i] == 'o') { acnt++; } } if (bcnt != acnt) { System.out.println("SUCCESS"); } else { if (bcnt == 0 || bcnt == 3) { System.out.println("FAILURE"); } else { String bs = new String(be); String as = new String(af); if (n == 0) { if (bs.equals(as)) { System.out.println("FAILURE"); } else { System.out.println("SUCCESS"); } } else if (n == 1) { if ( (bs.equals("oxo") && as.charAt(1) == 'o') || (bs.equals("xox") && as.charAt(1) == 'x') || (bs.equals("xox") && as.charAt(1) == 'x') || (bs.equals("xxo") && as.charAt(0) != 'o') || (bs.equals("oxx") && as.charAt(2) != 'o') || (bs.equals("oox") && as.charAt(0) != 'x') || (bs.equals("xoo") && as.charAt(2) != 'x') ) { System.out.println("FAILURE"); } else { System.out.println("SUCCESS"); } } else { System.out.println("FAILURE"); } } } sc.close(); } }