string = ""
gets.to_i.times do
  p, x = gets.chomp.split
  x.to_i.times do
    string<<p
  end
end

ok = true
stack = Array.new
string.size.times do |i|
  case string[i]
    when "("
      stack.push("(")
    when ")"
      if stack.empty?
        ok = false
      else
        stack.pop
      end
  end
end
ok = false if !stack.empty?

puts ok ? "Yes" : "No"