#include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; long long MOD = 1000000007; int main() { string SB,SA; long long N; cin >> SB >> N >> SA; int a = 0, b = 0; for ( int i = 0; i < 3; i++ ) { if ( SB[i] == 'o' ) { b++; } if ( SA[i] == 'o' ) { a++; } } if ( a != b ) { cout << "SUCCESS" << endl; } else if ( a == 3 || a == 0 ) { cout << "FAILURE" << endl; } else { if ( SB[0] != SA[0] && SB[2] != SA[2]) { cout << ( N >= 2 ? "FAILURE" : "SUCCESS" ) << endl; } else { cout << ( N >= 1 ? "SUCCESS" : "FAILURE" ) << endl; } } return 0; }