#include #include using namespace std; int main(){ string bef, aft; int N; cin >> bef >> N >> aft; int cnt = 0, cnt2 = 0; for(int i=0;i<3;++i) if(bef[i]=='o') ++cnt; for(int i=0;i<3;++i) if(aft[i]=='o') ++cnt2; bool ok = false; if(cnt != cnt2){ ok = false; } else if(cnt == 0 || cnt == 3){ ok = true; } else{ if(cnt == 1){ int x, y; for(int i=0;i<3;++i) if(bef[i] == 'o') x = i; for(int i=0;i<3;++i) if(aft[i] == 'o') y = i; if(y == 1){ ok = 1 + (x==y) <= N; } else{ ok = abs(x-y) <= N; } } else{ int x, y; for(int i=0;i<3;++i) if(bef[i] == 'x') x = i; for(int i=0;i<3;++i) if(aft[i] == 'x') y = i; if(y == 1){ ok = 1 + (x==y) <= N; } else{ ok = abs(x-y) <= N; } } } cout << (!ok? "SUCCESS": "FAILURE") << endl; return 0; }