#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; return 0; } else if ( a == 3 || b == 3 ) { cout << "FAILURE" << endl; return 0; } else { if ( SB[0] == SA[2] ) { cout << ( N >= 2 ? "FAILURE" : "SUCCESS" ) << endl; } else { cout << ( N%2 == 0 ? "SUCCESS" : "FAILURE" ) << endl; } } return 0; }