#include using namespace std; typedef long long ll; int main() { string sb; cin >> sb; ll n; cin >> n; string sa; cin >> sa; set sets; if (sb == "xxx" || sb == "ooo"||n == 0) { sets.insert(sb); } else if (n == 1) { string sd[2][5] = { { "oxx","xox","xxo","xox","oxx" }, { "xoo", "oxo", "oox", "oxo", "xoo" } }; for (int i = 0;i < 2;i++) { for (int j = 0;j < 4;j++) { if (sb == sd[i][j]) { sets.insert(sd[i][j + 1]); } } } } else { string sd[2][5] = { { "oxx","xox","xxo","oxx","xox" },{ "xoo", "oxo", "oox", "xoo", "oxo" } }; for (int i = 0;i < 2;i++) { for (int j = 0;j < 3;j++) { if (sb == sd[i][j]) { sets.insert(sd[i][j + 1]); sets.insert(sd[i][j + 2]); } } } } cout << ((sets.find(sa) == sets.end()) ? "SUCCESS":"FAILURE") << endl; return 0; }