#include int main() { std::string str_i, str_o; std::string str; long N; long p[12]; bool ans = true; p[0] = 1; for(int i = 1; i < 12; ++i) { p[i] = 2 * p[i-1]; } std::cin >> str_i >> N >> str_o; if( N >= 12 ) { N = 6 + (N % 6); } if( N == 0 ) { if( str_i == str_o ) { ans = false; goto label_1; } } for(int i = 0; i < p[N]; ++i) { str = str_i; for(int j = 0; j < N; ++j) { if( (i & (1 << j)) == 0 ) { std::swap(str[0], str[1]); } else { std::swap(str[1], str[2]); } } if( str == str_o ) { ans = false; goto label_1; } } label_1: if( ans ) { std::cout << "SUCCESS" << std::endl; } else { std::cout << "FAILURE" << std::endl; } return 0; }