#include #include #include #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; using ll = long long; constexpr int INF = 1001001001; // constexpr int mod = 1000000007; constexpr int mod = 998244353; template inline bool chmax(T& x, T y){ if(x < y){ x = y; return true; } return false; } template inline bool chmin(T& x, T y){ if(x > y){ x = y; return true; } return false; } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); string s, t; int n; cin >> s >> n >> t; int cs = 0, ct = 0; for(int i = 0; i < 3; ++i){ cs += s[i] == 'o'; ct += t[i] == 'o'; } if(cs != ct || cs == 0 || cs == 3){ cout << "SUCCESS\n"; return 0; } int diff = 0; if(cs == 1){ for(int i = 0; i < 3; ++i){ if(s[i] == 'o') diff += i; } for(int i = 0; i < 3; ++i){ if(t[i] == 'o') diff = abs(diff - i); } } else{ for(int i = 0; i < 3; ++i){ if(s[i] == 'x') diff += i; } for(int i = 0; i < 3; ++i){ if(t[i] == 'x') diff = abs(diff - i); } } if(n >= diff) cout << "FAILURE\n"; else cout << "SUCCESS\n"; return 0; }