while line=gets
  line.chomp!
  if line == "." then break end
  symbols = []
  flg = true
  line.each_char do |c|
    case c
    when '(', '['
      symbols << c
    when ')'
      if symbols.pop != '(' then flg = false end
    when ']'
      if symbols.pop != '[' then flg = false end
    end
  end
  puts flg ? 'yes' : 'no'
end