import java.util.*; public class Exercise105{ public static void main (String[] args){ Scanner sc = new Scanner(System.in); String sb = sc.next(); char[] sbArray = sb.toCharArray(); int sbO = getCount(sbArray, 'o'); int n = sc.nextInt(); String sa = sc.next(); char[] saArray = sa.toCharArray(); int saO = getCount(saArray, 'o'); if(sbO != saO){ System.out.println("SUCCESS"); return; }else if(sbO > 0 && saO > 0){ if(n == 0 && !Arrays.equals(sbArray, saArray)){ System.out.println("SUCCESS"); return; }else if(n == 1){ if(sbArray[0] != sbArray[2] && saArray[0] != saArray[2] && sbArray[0] != saArray[0]){ System.out.println("SUCCESS"); return; }else if(sbArray[0] != sbArray[1] && sbArray[0] == sbArray[2] && sbArray[1] == saArray[1]){ System.out.println("SUCCESS"); return; } } } System.out.println("FAILURE"); } private static int getCount(char[] array, char p){ int count = 0; for(char y: array){ if(y == p){ count++; } } return count; } }