#include #include #include #include using namespace std; void swap(char* x, char* y) { char tmp = *x; *x = *y; *y = tmp; } int main(void) { string be, af; long long N; int num = -1; int cnt = 0; cin >> be >> N >> af; for(int i = -1; i <= 1; i++){ string tmp = be; for(int j = -1; j <= 1; j++){ swap(tmp[i*j + 1], tmp[1]); if(tmp == af){ if(num == -1){ num=abs(i) *(j + 3) / 2; } else{ num = min(abs(i) *(j + 3) / 2, num); } } } } if((af.find("xx") != string::npos || af.find("oo") != string::npos)){ if(num != -1 && N - num >= 0){ cout << "FAILURE" << endl; } else{ cout << "SUCCESS" << endl; } } else{ if(num != -1 && N - num >= 0&&(N-num)%2==0){ cout << "FAILURE" << endl; } else{ cout << "SUCCESS" << endl; } } return 0; }