#include int main() { char s[4], t[4]; int i, n, a, b; int res; scanf("%s", s); scanf("%d", &n); scanf("%s", t); a = b = 0; for ( i = 0; i < 4; i++ ) { a += (s[i] == 'o') << (2-i); b += (t[i] == 'o') << (2-i); } switch ( a ) { case 0: case 7: res = ( b != a ) ? 1 : 0; break; case 1: case 4: if ( n % 2 ) { res = ( b != 2 ) ? 1 : 0; } else { res = ( !(b == 1 || b == 4) ) ? 1 : 0; } break; case 3: case 6: if ( n % 2 ) { res = ( b != 5 ) ? 1 : 0; } else { res = ( !(b == 3 || b == 6) ) ? 1 : 0; } break; case 2: if ( n % 2 ) { res = ( !(b == 1 || b == 4) ) ? 1 : 0; } else { res = ( b != 2 ) ? 1 : 0; } break; case 5: if ( n % 5 ) { res = ( !(b == 3 && b == 6) ) ? 1 : 0; } else { res = ( b != 5 ) ? 1 : 0; } } if ( res ) { printf("SUCCESS\n"); } else { printf("FAILURE\n"); } }