### subroutines

def valid?(str)
  pars = []

  for i in (0...str.length)
    case str[i]
    when '('
      pars << '('
    when '['
      pars << '['
    when ')'
      ch = pars.pop
      return false if ch != '('
    when ']'
      ch = pars.pop
      return false if ch != '['
    end
  end
  true
end

### main

loop do
  str = gets.rstrip
  break if str == '.'

  puts valid?(str) ? 'yes' : 'no'
end