import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Iterator; import java.util.Scanner; public class Main { static char[] Sb; static char[] Sa; static int N; private static void solve() { int sbo = 0; int sao = 0; for(int i = 0; i<3; i++){ if(Sb[i] == 'o'){ sbo++; } if(Sa[i] == 'o'){ sao++; } } if(sbo != sao){ System.out.println("SUCCESS"); return; } if(N>=2){ System.out.println("FAILURE"); return; } ArrayList list = new ArrayList(); list.add(Sb); if(N == 1){ list.add(new char[]{Sb[1], Sb[0], Sb[2]}); list.add(new char[]{Sb[0], Sb[2], Sb[1]}); } Iterator ite = list.iterator(); while(ite.hasNext()){ char[] c = ite.next(); if(c[0] == Sa[0] && c[1] == Sa[1] && c[2] == Sa[2]){ System.out.println("FAILURE"); return; } } System.out.println("SUCCESS"); return; } public static void main(String[] args) { read(); solve(); } public static void read(){ Scanner scan = new Scanner(new InputStreamReader(System.in)); Sb = scan.next().toCharArray(); N = scan.nextInt(); Sa = scan.next().toCharArray(); scan.close(); } }