#include using namespace std; typedef vector vi; typedef pair pii; typedef long long ll; #define FOR(i,a,b) for(int i=(a);i<(b);i++) #define REP(i,n) FOR(i,0,n) int main(){ // char Sbefore[3]; // char Safter[3]; string Sbefore; string Safter; int N=0; cin >> Sbefore ; cin >> N; cin >> Safter ; int fail_count=0; for(int i=0;i<3;i++){ if(Sbefore[i] != Safter[i]){ fail_count ++; } } if(count(Sbefore.begin(),Sbefore.end(),'o') != count(Safter.begin(),Safter.end(),'o')){ printf("SUCCESS\n"); }else if((N == 0 and fail_count > 0) or (N == 1 and Sbefore[0] != Safter[0] and Sbefore[2] != Safter[2])){ printf("SUCCESS\n"); }else{ printf("FAILURE\n"); } return 0; }