#include typedef long long ll; using namespace std; int INF = 1e9; int MOD = 1000000007; main(){ int N,cnt = 0; string s,t; cin >> s >> N >> t; for(char c:s)if(c == 'o')cnt++; for(char c:t)if(c == 'o')cnt--; if(cnt){ cout << "SUCCESS" << endl; return 0; } if(N == 0){ if(s == t)cout << "FAILURE" << endl; else cout << "SUCCESS" << endl; }else if(N == 1){ using std::swap; for(int i = 0;i < 2;i++){ swap(s[i],s[(i+1)%3]); if(s == t){ cout << "FAILURE" << endl; return 0; } swap(s[i],s[(i+1)%3]); } cout << "SUCCESS" << endl; }else{ cout << "FAILURE" << endl; } }