import java.io.*; import java.util.*; import java.math.*; class Main { public static void out (Object o) { System.out.println(o); } public static boolean solve (String s , String t , int n) { int cnt1 = 0 , cnt2 = 0; for (int i = 0; i < s.length(); i++) { if (s.charAt(i) == 'o') cnt1++; if (t.charAt(i) == 'o') cnt2++; } if (cnt1 != cnt2) return true; if (cnt1 == 0 || cnt1 == 3) return false; int p1 = -1 , p2 = -1; if (cnt1 == 1) { p1 = s.indexOf("o"); p2 = t.indexOf("o"); } else { p1 = s.indexOf("x"); p2 = t.indexOf("x"); } if (p1 == 1) { if (p2 == 1) { return n == 1; } else { return n == 0; } } else { if (p2 == 1) { return n == 0; } else { return p1 == p2 ? false : n < 2; } } } public static void main (String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String s = br.readLine(); int n = Integer.parseInt(br.readLine()); String t = br.readLine(); out(solve(s , t , n) ? "SUCCESS" : "FAILURE"); } }