#include #include #include using namespace std; int main() { string s1, s2; int n; cin >> s1 >> n >> s2; vector m1, b1, m2, b2; for(int i = 0; i < 3; i++) { if(s1[i] == 'o') m1.push_back(i); else b1.push_back(i); if(s2[i] == 'o') m2.push_back(i); else b2.push_back(i); } if(m1.size() != m2.size()) { cout << "SUCCESS" << endl; return 0; } if(m1.size() == 3 || b1.size() == 3) { cout << "FAILURE" << endl; return 0; } if(m1.size() == 1) { if(abs(m1[0] - m2[0]) == 0 && n % 2 == 0 || abs(m1[0] - m2[0]) == 1 && n % 2 == 1 || abs(m1[0] - m2[0]) == 2 && n % 2 == 0 && n >= 2) { cout << "FAILURE" << endl; return 0; } else { cout << "SUCCESS" << endl; return 0; } } else { if(abs(b1[0] - b2[0]) == 0 && n % 2 == 0 || abs(b1[0] - b2[0]) == 1 && n % 2 == 1 || abs(b1[0] - b2[0]) == 2 && n % 2 == 0 && n >= 2) { cout << "FAILURE" << endl; return 0; } else { cout << "SUCCESS" << endl; return 0; } } }