#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define _CRT_SECURE_NO_WARNINGS #define rep(i, n) for(int i=0; i<(n); i++) #define FOR(i, m, n) for(int i=(m);i<(n);i++) #define SZ(x) ((int)(x).size()) #define ALL(x) (x).begin(),(x).end() #define SORT(x) sort((x).begin(),(x).end()) #define REVE(x) reverse((x).begin(),(x).end()) #define MP make_pair #define PB push_back typedef vector VI; typedef vector VS; typedef vector> VVI; typedef pair PII; typedef long long LL; int main() { string s1, s2; int n, c1 = 0, c2 = 0; cin >> s1 >> n >> s2; rep(i, 3) { if (s1[i] == 'o')c1++; if (s2[i] == 'o')c2++; } bool flag; if (c1 != c2)flag = true; else { if (n == 0)flag = s1 == s2 ? false : true; else if (n == 1) { if ((s1 == "oxo"&&s2 == "oxo") || (s1 == "xox"&&s2 == "xox") || (s1 == "xoo"&&s2 == "oox") || (s1 == "oox"&&s2 == "xoo") || (s1 == "oxx"&&s2 == "xxo") || (s1 == "xxo"&&s2 == "oxx"))flag = true; else flag = false; } else if (2 <= n)flag = false; } puts(flag ? "SUCCESS" : "FAILURE"); }