#include using namespace std; int main(){ string sb; string sa; int N; cin >> sb >> N >> sa; int cnt1=0,cnt2=0,cnt3=0,cnt4=0; for(int i=0;i<3;i++){ if(sb[i]=='o') cnt1++; else cnt2++; } for(int i=0;i<3;i++){ if(sa[i]=='o') cnt3++; else cnt4++; } if(cnt1!=cnt3||cnt2!=cnt4){ cout << "SUCCESS" << endl; }else{ if(cnt1==3||cnt2==3){ cout << "FAILURE" << endl; }else if(sb=="oxo"||sb=="xox"){ if(sa==sb&&N==1){ cout << "SUCCESS" << endl; }else{ cout << "FAILURE" << endl; } }else if(sb=="oox"||sb=="xxo"){ if(N==0&&sb!=sa){ cout << "SUCCESS" << endl; }else if(N==1&&sb[2]==sa[0]){ cout << "SUCCESS" << endl; }else{ cout << "FAILURE" << endl; } }else if(sb=="xoo"||sb=="oxx"){ if(N==0&&sb!=sa){ cout << "SUCCESS" << endl; }else if(N==1&&sb[0]==sa[2]){ cout << "SUCCESS" << endl; }else{ cout << "FAILURE" << endl; } } } }