def check_bracket(str)
  arr = []
  str.split('').each do |st|
    if st == '[' or st == '('
      arr.push(st)
    elsif st == ']' and arr.pop != '['
      return 'no'
    elsif st == ')' and arr.pop != '('
      return 'no'
    end
  end
  arr.size == 0 ? 'yes' : 'no'
end

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