#!/usr/bin/ruby

MARU = 0
KAKU = 1

def check ln
  read = []
  ln.split("").each do |c|
    if c == '('
      read << MARU
    elsif c == '['
      read << KAKU
    elsif c == ')'
      last = read.pop
      return false if last != MARU
    elsif c == ']'
      last = read.pop
      return false if last != KAKU
    end
  end
  read.size == 0
end

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