a = gets.chomp b = a.split(/\s*/) c = b.sort if c[0] == c[1] && c[2] == c[3] && c[4] == c[5] && c[6] == c[7] p "YES" else p "NO" end