def check(s)
  stack=[]
  s.size.times{|i|
    case s[i].chr
    when '('
      stack.push(s[i].chr)
    when '['
      stack.push(s[i].chr)
    when ')'
      prv=stack.pop
      if prv!='('
        return false
      end
    when ']'
      prv=stack.pop
      if prv!='['
        return false
      end
    end
  }
  if stack.empty?
    return true
  else
    return false
  end
end

while s=gets.chomp! do
  if s=="."
    break
  end
  if check(s)
    puts "yes"
  else
    puts "no"
  end
end