import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String before = sc.next(); int N = sc.nextInt(); String after = sc.next(); sc.close(); int bCoins = 0; int aCoins = 0; for (int i = 0; i < 3; i++) { if (before.charAt(i) == 'o') { bCoins++; } if (after.charAt(i) == 'o') { aCoins++; } } if (aCoins != bCoins) { System.out.println("SUCCESS"); return; } if (aCoins == 0 || aCoins == 3) { System.out.println("FAILURE"); return; } if (aCoins == 1) { before = before.replaceAll("o", "1").replaceAll("x", "2"); after = after.replaceAll("o", "1").replaceAll("x", "2"); } else { before = before.replaceAll("o", "2").replaceAll("x", "1"); after = after.replaceAll("o", "2").replaceAll("x", "1"); } if (before.equals(after)) { if (N % 2 == 0) { System.out.println("FAILURE"); return; } System.out.println("SUCCESS"); return; } if (before.equals("122") || before.equals("221")) { if (after.equals("212")) { if (N % 2 == 1) { System.out.println("FAILURE"); return; } System.out.println("SUCCESS"); return; } else { if (N % 2 == 1 || N < 2) { System.out.println("SUCCESS"); return; } System.out.println("FAILURE"); return; } } else { if (N % 2 == 0) { System.out.println("SUCCESS"); return; } System.out.println("FAILURE"); return; } } }