#include #include #include #include #include #include #include #include #include #include using namespace std; const int MAX= 10000100; #define loop(i,a,b) for(int i = a ; i < b ; i ++) #define rep(i,a) loop(i,0,a) #define all(a) (a).begin(),(a).end() #define ll long long int #define gcd(a,b) __gcd(a,b) #define pb(a) push_back(a) int GCD(int a, int b) {if(!b) return a; return gcd(b, a%b);} int lcm(int a, int b) {return a*b / gcd(a, b);} int main(void){ string sb,sf; int n; cin>>sb>>n>>sf; bool ans = false; if(sb[0] == 'o' && sb[1] == 'x' && sb[2] == 'x' && sf[0] == 'x' && sf[1] == 'x' && sf[2] == 'o' && n <= 2){ ans = true; }else if(sb[0] == 'x' && sb[1] == 'x' && sb[2] == 'o' && sf[0] == 'o' && sf[1] == 'x' && sf[2] == 'x' && n <= 2){ ans = true; }else if(sb[0] == 'o' && sb[1] == 'o' && sb[2] == 'x' && sf[0] == 'x' && sf[1] == 'o' && sf[2] == 'o' && n <= 1){ ans = true; }else if(sb[0] == 'x' && sb[1] == 'o' && sb[2] == 'o' && sf[0] == 'o' && sf[1] == 'o' && sf[2] == 'x' && n <= 1){ ans = true; }else if(n == 0 && sb != sf){ ans = true; }else{ int sfnum = 0; int sbnum = 0; rep(i,sb.size()){ if(sb[i] == 'o')sbnum++; } rep(i,sf.size()){ if(sf[i] == 'o')sfnum++; } if(sfnum != sbnum){ ans = true; } } cout<<(ans?"SUCCESS":"FALURE")<