#include using namespace std; typedef long long ll; typedef vector VI; typedef vector VVI; typedef vector VL; typedef vector VVL; typedef pair PII; #define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i) #define REP(i, n) FOR(i, 0, n) #define ALL(x) x.begin(), x.end() #define MOD 1000000007 #define INF (1LL << 25) // 33554432 #define PI 3.14159265359 #define EPS 1e-12 //#define int ll signed main(void) { int n, a = 0, b = 0; string s, t; cin >> s >> n >> t; REP(i, s.size()) { if (s[i] == 'o') a++; if (t[i] == 'o') b++; } if (a != b) { cout << "SUCCESS" << endl; return 0; } if (n == 1) { if (a == 1) { if ((s == "oxx" && t == "xxo") || (s == "xxo" && t == "oxx") || (s == "xox" && t == "xox")) { cout << "SUCCESS" << endl; return 0; } } else if (a == 2) { if ((s == "oox" && t == "xoo") || (s == "xoo" && t == "oox") || (s == "xox" && t == "xox")) { cout << "SUCCESS" << endl; return 0; } } } else if(n == 0) { if(s != t) { cout << "SUCCESS" << endl; return 0; } } cout << "FAILURE" << endl; return 0; }