#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 && (num == -1 || (N - num) % 2 != 0)){ num = abs(i) *(j + 3) / 2; } } } if(num==-1||(N-num)<0||(N-num)%2!=0){ cout << "SUCCESS" << endl; } else{ cout << "FAILURE" << endl; } return 0; }