import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); String s1 = scan.next(); int N = scan.nextInt(); String s2 = scan.next(); scan.close(); int cnt1 = 0; int cnt2 = 0; for(int i = 0; i < 3; i++) { if(s1.charAt(i) == 'o') { cnt1 ++; } if(s2.charAt(i) == 'o') { cnt2 ++; } } if(cnt1 != cnt2) { System.out.println("SUCCESS"); System.exit(0); } if(N == 0) { if(s1.equals(s2)) { System.out.println("FAILURE"); System.exit(0); }else { System.out.println("SUCCESS"); System.exit(0); } } String[] a2 = s2.split(""); String t1 = s2; String t2 = a2[1] + a2[0] + a2[2]; String t3 = a2[0] + a2[2] + a2[1]; String t4 = a2[1] + a2[2] + a2[0]; String t5 = a2[2] + a2[0] + a2[1]; String t6 = a2[2] + a2[1] + a2[0]; if(N % 2 == 0) { if(s1.equals(t1) || s1.equals(t4) || s1.equals(t5)) { System.out.println("FAILURE"); }else { System.out.println("SUCCESS"); } }else { if(N == 1) { if(s1.equals(t2) || s1.equals(t3)) { System.out.println("FAILURE"); }else { System.out.println("SUCCESS"); } }else { if(s1.equals(t2) || s1.equals(t3) || s1.equals(t6)) { System.out.println("FAILURE"); }else { System.out.println("SUCCESS"); } } } } }