#include #include #include using namespace std; #define RREP(i,s,e) for (int i = e-1; i >= s; i--) #define rrep(i,n) RREP(i,0,n) #define REP(i,s,e) for (int i = s; i < e; i++) #define rep(i,n) REP(i,0,n) int main() { string s1,s2; long long n; int cnt1, cnt2; cin >> s1 >> n >> s2; cnt1 = cnt2 = 0; rep (i,3) { cnt1 += s1[i] == 'o'; cnt2 += s2[i] == 'o'; } if (cnt1 != cnt2 || n == 0 && s1 != s2) cout << "SUCCESS" << endl; else if (n >= 2 || s1 == s2) cout << "FAILURE" << endl; else if (string{}+s1[1]+s1[0]+s1[2] == s2 || string{}+s1[0]+s1[2]+s1[1] == s2) cout << "FAILURE" << endl; else cout << "SUCCESS" << endl; return 0; }