//No.197 手品 import java.util.*; import java.io.*; import static java.util.Arrays.*; import static java.lang.Math.*; public class No0197 { static final Scanner in = new Scanner(System.in); static final PrintWriter out = new PrintWriter(System.out,false); static void solve() { String sb = in.next(); long n = in.nextLong(); String sa = in.next(); int cnt1 = 0, cnt2 = 0; for (int i=0; i<3; i++) { if (sb.charAt(i) == 'o') cnt1++; if (sa.charAt(i) == 'o') cnt2++; } if (cnt1 != cnt2) { out.println("SUCCESS"); }else if (n >= 2) { out.println("FAILURE"); }else if (n == 0) { out.println(sb == sa ? "FAILURE" : "SUCCESS"); }else { out.println((sb.charAt(0) == sa.charAt(1) && sb.charAt(1) == sa.charAt(0) && sb.charAt(2) == sa.charAt(2)) || (sb.charAt(0) == sa.charAt(0) && sb.charAt(1) == sa.charAt(2) && sb.charAt(2) == sa.charAt(1)) ? "FAILURE" : "SUCCESS"); } } public static void main(String[] args) { long start = System.currentTimeMillis(); solve(); out.flush(); long end = System.currentTimeMillis(); //trace(end-start + "ms"); in.close(); out.close(); } static void trace(Object... o) { System.out.println(deepToString(o));} }