import java.util.Scanner; class Main{ public static void main(String[] args){ Scanner sc=new Scanner(System.in); int n,t[]=new int[2],f=0; String s[]=new String[2]; s[0]=sc.next(); n=sc.nextInt(); s[1]=sc.next(); sc.close(); for(int i=0;i<2;++i)for(int j=0;j<3;++j)if(s[i].charAt(j)=='o')++t[i]; if(t[0]!=t[1])f=1; else if(2>n&&(n>0&&(s[0].equals("oxo")&&s[1].equals("oxo")||s[0].equals("xox")&&s[1].equals("xox"))||s[0].equals("oox")&&s[1].equals("xoo")||s[0].equals("xoo")&&s[1].equals("oox")||s[0].equals("oxx")&&s[1].equals("xxo")||s[0].equals("xxo")&&s[1].equals("oxx")))f=1; else if(1>n&&s[0].equals(s[1]))f=1; System.out.print(f>0?"SUCCESS":"FAILURE"); } }