def check_bracket(str)
  stack = []
  str.chars do |st|
    if st =~ /(\[|\()/
      stack.push(st)
    elsif st == "]" and stack.pop != "["
      return "no"
    elsif st == ")" and stack.pop != "("
      return "no"
    end
  end
  return stack.empty? ? "yes" : "no"
end

while gets do
  str = $_.chomp
  break if str == "."
  puts check_bracket(str)
end