s1 = gets.chomp n = gets.to_i s2 = gets.chomp def enable(s1, s2, n) return false if s1.count(?o) != s2.count(?o) return false if n == 0 && s1 != s2 return true if n > 1 return false if s1 == "oxo" && s2 == "oxo" && n == 1 return false if s1 == "xox" && s2 == "xox" && n == 1 return false if s1 == "oxx" && s2 == "xxo" && n == 1 return false if s1 == "xxo" && s2 == "oxx" && n == 1 return false if s1 == "oox" && s2 == "xoo" && n == 1 return false if s1 == "xoo" && s2 == "oox" && n == 1 true end puts enable(s1, s2, n) ? "FAILURE" : "SUCCESS"