import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
Queue <Character> q = new LinkedList<>();
ArrayList <Character> al = new ArrayList<>();
while (true) {
q.clear();
al.clear();
String str = sc.nextLine();
if(str.equals(".")) {
break;
}
String fis = "";
for (int i = 0; i < str.length(); i++) {
char t = str.charAt(i);
if ((t == '(') || (t == ')') || (t == '[') || (t == ']')) {
q.add(t);
al.add(t);
}
}
System.out.println(solver(q));
}
}
private static String solver(Queue <Character> q) {
Stack<Character> stack = new Stack<>();
int n = q.size();
for(int i=0 ; i<n ; i++ ) {
char c = q.remove();
if(c == '(' || c=='[') {
stack.push(c);
}
else if(c == ')') {
if(stack.empty() || stack.peek() != '(') {
return "no";
}
else {
stack.pop();
}
}
else if( c==']') {
if(stack.empty() || stack.peek() != '[') {
return "no";
}
else {
stack.pop();
}
}
}
if(stack.empty()) {
return "yes";
}
else {
return "no";
}
}
}