#include #include #include using namespace std; vector> E = {{0}, {1, 2}, {1, 4}, {3, 5}, {2, 4}, {3, 6}, {5, 6}, {7}}; int main(){ string S; cin >> S; int N; cin >> N; string T; cin >> T; if (N >= 2){ N = N % 2 + 2; } int s = 0; for (int i = 0; i < 3; i++){ if (S[i] == 'o'){ s += 1 << i; } } int t = 0; for (int i = 0; i < 3; i++){ if (T[i] == 'o'){ t += 1 << i; } } bool ok = false; if (N == 0){ if (s == t){ ok = true; } } if (N == 1){ for (int u : E[s]){ if (u == t){ ok = true; } } } if (N == 2){ for (int u : E[s]){ for (int v : E[u]){ if (v == t){ ok = true; } } } } if (N == 3){ for (int u : E[s]){ for (int v : E[u]){ for (int w : E[v]){ if (w == t){ ok = true; } } } } } if (ok){ cout << "FAILURE" << endl; } else { cout << "SUCCESS" << endl; } }