use std::io::*; fn main() { let mut s: String = String::new(); std::io::stdin().read_to_string(&mut s).ok(); let mut itr = s.trim().split_whitespace(); let s: Vec = itr.next().unwrap().chars().collect(); let n: usize = itr.next().unwrap().parse().unwrap(); let t: Vec = itr.next().unwrap().chars().collect(); if n == 0 { let u: String = s.into_iter().collect(); let v: String = t.into_iter().collect(); if u == v { println!("FAILURE"); } else { println!("SUCCESS"); } } else { let a = s .iter() .fold(0, |acc, x| if *x == 'o' { acc + 1 } else { acc }); let b = t .iter() .fold(0, |acc, x| if *x == 'o' { acc + 1 } else { acc }); if a != b { println!("SUCCESS",) } else { if a == 1 { if n == 1 && ((s[0] == 'o' && t[2] == 'o') || (s[2] == 'o' && t[0] == 'o') || (s[1] == 'o' && t[1] == 'o')) { println!("SUCCESS"); } else { println!("FAILURE"); } } else if a == 2 { if n == 1 && ((s[0] == 'x' && t[2] == 'x') || (s[2] == 'x' && t[0] == 'x') || (s[1] == 'x' && t[1] == 'x')) { println!("SUCCESS"); } else { println!("FAILURE"); } } else { println!("FAILURE"); } } } }