object Main{

  def search(str: String): Boolean = {
    var lst = List[Char]()
    str.foreach{ 
      c => c match{
        case '(' => lst = '(' :: lst
        case '[' => lst = '[' :: lst
        case ')' => if(!lst.isEmpty && lst.head == '('){
          lst = lst.tail
        }else{
          return false
        }
        case ']' => if(!lst.isEmpty && lst.head == '['){
          lst = lst.tail
        }else{
          return false
        }
      }
    }
    return lst.isEmpty
  }

  def main(args: Array[String]) = {
    var line = readLine
    while(line != "."){
      val l = line.filter(c=>"()[]".contains(c))
      if( search(l) ){
        println("yes")
      }else{
        println("no")
      }
      line = readLine
    }
  }

}