def check_bracket(str)
  stack = []
  str.split('').each do |st|
    if st == '[' or st == '('
      stack.push(st)
    elsif st == ']' and stack.pop != '['
      return false
    elsif st == ')' and stack.pop != '('
      return false
    end
  end
  return stack.empty?
end

while gets do
  str = $_.chomp
  break if str == '.'
  puts check_bracket(str) ? 'yes' : 'no'
end