s_before = gets.chomp n = gets.to_i s_after = gets.chomp before_o = s_before.count('o') after_o = s_after.count('o') if before_o != after_o puts :SUCCESS elsif n == 0 puts s_before == s_after ? :FAILURE : :SUCCESS elsif n == 1 d = s_before.dup d[0], d[1] = d[1], d[0] s_before[0], s_before[1] = s_before[1], s_before[0] puts(d == s_after || s_before == s_after ? :FAILURE : :SUCCESS) else puts :FAILURE end