/// 백준 - 4949 균형잡힌 세상

// 문자열이 주어졌을 때, 괄호들의 균형이 잘 맞춰져있는지 판단
// 괄호의 종류는 소괄호 (), 대괄호 []

// 각 문자열은 알파벳, 공백, 소괄호, 대괄호로 이뤄지며, 온점 "."으로 끝나고, 길이는 100글자 이하
// 각 줄마다 균형을 이루면 yes, 아니면 no를 출력

#include <bits/stdc++.h>
using namespace std;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);

    // 문장들 입력받아서 lines에 넣기
    vector<string> lines;
    string line;
    while(getline(cin, line)){
        lines.push_back(line);
        if (line == ".") break;
    }

    // lines에서 하나씩 빼서 사용
    for (int i=0; i<lines.size(); i++){
        if (lines[i] == ".") {break;}
        stack<char> stack;
        for (int num=0; num<lines[i].length(); num++){
            if (lines[i][num] == '(' || lines[i][num] == '[') {stack.push(lines[i][num]);}
            else if (lines[i][num] == ')'){
                if (stack.empty() || stack.top() != '(') {cout << "no" << '\n'; break;}
                else if (stack.top() == '(') stack.pop();
            }
            else if (lines[i][num] == ']'){
                if (stack.empty() || stack.top() != '[') {cout << "no" << '\n'; break;}
                else if (stack.top() == '[') stack.pop();
            }
            else if (lines[i][num] == '.') {
                cout << "yes" << '\n'; break;
            }
        }
    }
    return 0;
}