#include using namespace std; int main() { string S_bef, S_aft; int N; cin >> S_bef >> N >> S_aft; bool flag = false; if (N == 0) flag = S_bef == S_aft; else { int cnt_bef = 0, cnt_aft = 0; int parity_bef = 0, parity_aft = 0; for (int i = 0; i < 3; i++) { cnt_bef += S_bef[i] == 'o'; cnt_aft += S_aft[i] == 'o'; parity_bef += (S_bef[i] == 'o') * (i + 1); parity_aft += (S_aft[i] == 'o') * (i + 1); if (cnt_bef == cnt_aft) { if (abs(parity_bef - parity_aft) % 2 == N % 2) flag = true; } } } cout << (flag ? "FAILURE" : "SUCCESS") << endl; }