#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define LL long long int main(void){ string s; string m; LL N; cin >> s >> N >> m; int cnt1 = 0; int cnt2 = 0; for (int i = 0; i < 3; i++){ if (s[i] == 'o')cnt1++; if (m[i] == 'o')cnt2++; } if (cnt1!=cnt2){ cout << "SUCCESS" << endl; return 0; } if (cnt1 == 0 || cnt1 == 3){ cout << "FAILURE" << endl; return 0; } if ((cnt1 == 1 && s[1] == 'o') || (cnt1 == 2 && s[1] == 'x') || (cnt1 == 1 && m[1] == 'o') || (cnt1 == 2 && m[1] == 'x')){ if (s == m){ if (N ==1){ cout << "SUCCESS" << endl; return 0; } else{ cout << "FAILURE" << endl; return 0; } } else{ if (N ==0){ cout << "SUCCESS" << endl; return 0; } else{ cout << "FAILURE" << endl; return 0; } } } if (s == m){ if (N == 1){ cout << "SUCCESS" << endl; return 0; } else{ cout << "FAILURE" << endl; return 0; } } else{ if (N <2){ cout << "SUCCESS" << endl; return 0; } else{ cout << "FAILURE" << endl; return 0; } } return(0); }