#!/usr/bin/ruby

def check ln
  maru = 0
  kaku = 0
  ln.split("").each do |c|
    if c == '('
      maru += 1
    elsif c == '['
      kaku += 1
    elsif c == ')'
      maru -= 1
      return false if maru < 0
    elsif c == ']'
      kaku -= 1
      return false if kaku < 0
    end
  end
  (maru == 0) and (kaku == 0)
end

loop do
  ln = gets.chomp
  break if ln == '.'
  res = if (check ln) then "yes" else "no" end
  puts res
end