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