#include int main(void){ int i,n; int ans = 1; char before[10]; char after[10]; scanf("%s", before); scanf("%d", &n); scanf("%s", after); if(n == 0){ for(i=0;i<3;i++){ if(before[i] != after[i]){ break; } } if(i == 3){ ans = 0;} }else if(n == 1){ char tmp; tmp = before[0]; before[0] = before[1]; before[1] = tmp; for(i=0;i<3;i++){ if(before[i] != after[i]){ break; } } if(i==3){ ans = 0; }else{ tmp = before[0]; before[0] = before[1]; before[1] = tmp; tmp = before[1]; before[1] = before[2]; before[2] = tmp; for(i=0;i<3;i++){ if(before[i] != after[i]){ break; } } if(i==3){ans=0;} } }else{ int ok=0, ng=0; for(i=0;i<3;i++){ if(before[i] == 'o'){ok++;} if(before[i] == 'x'){ng++;} if(after[i] == 'o'){ok--;} if(after[i] == 'x'){ng--;} } if(ok == 0 && ng == 0){ ans = 0; } } if(ans){ printf("SUCCESS\n"); }else{ printf("FAILURE\n"); } return 0; }