import java.util.* ;
class B {
public void run( ) {
Scanner sc
= new Scanner
( System .
in ) ; for ( String s
= sc.
nextLine ( ) ; ! s.
equals ( "." ) ; s
= sc.
nextLine ( ) ) System .
out .
println ( check
( s
) ? "yes" : "no" ) ; }
private boolean check
( String s
) { Stack< Character> st = new Stack< Character> ( ) ;
for ( char c : s.toCharArray ( ) )
if ( c == '(' || c == '[' )
st.push ( c) ;
else if ( c == ')' ) {
if ( st.isEmpty ( ) || st.pop ( ) != '(' )
return false ;
} else if ( c == ']' ) {
if ( st.isEmpty ( ) || st.pop ( ) != '[' )
return false ;
}
return st.isEmpty ( ) ;
}
new B( ) .run ( ) ;
}
}
aW1wb3J0IGphdmEudXRpbC4qOwoKY2xhc3MgQiB7CgoJcHVibGljIHZvaWQgcnVuKCkgewoJCVNjYW5uZXIgc2MgPSBuZXcgU2Nhbm5lcihTeXN0ZW0uaW4pOwoJCWZvciAoU3RyaW5nIHMgPSBzYy5uZXh0TGluZSgpOyAhcy5lcXVhbHMoIi4iKTsgcyA9IHNjLm5leHRMaW5lKCkpCgkJCVN5c3RlbS5vdXQucHJpbnRsbihjaGVjayhzKSA/ICJ5ZXMiIDogIm5vIik7Cgl9CgoJcHJpdmF0ZSBib29sZWFuIGNoZWNrKFN0cmluZyBzKSB7CgkJU3RhY2s8Q2hhcmFjdGVyPiBzdCA9IG5ldyBTdGFjazxDaGFyYWN0ZXI+KCk7CgkJZm9yIChjaGFyIGMgOiBzLnRvQ2hhckFycmF5KCkpCgkJCWlmIChjID09ICcoJyB8fCBjID09ICdbJykKCQkJCXN0LnB1c2goYyk7CgkJCWVsc2UgaWYgKGMgPT0gJyknKSB7CgkJCQlpZiAoc3QuaXNFbXB0eSgpIHx8IHN0LnBvcCgpICE9ICcoJykKCQkJCQlyZXR1cm4gZmFsc2U7CgkJCX0gZWxzZSBpZiAoYyA9PSAnXScpIHsKCQkJCWlmIChzdC5pc0VtcHR5KCkgfHwgc3QucG9wKCkgIT0gJ1snKQoJCQkJCXJldHVybiBmYWxzZTsKCQkJfQoJCXJldHVybiBzdC5pc0VtcHR5KCk7Cgl9CgoJcHVibGljIHN0YXRpYyB2b2lkIG1haW4oU3RyaW5nW10gYXJncykgdGhyb3dzIEV4Y2VwdGlvbiB7CgkJbmV3IEIoKS5ydW4oKTsKCX0KfQ==
stdin
U28gd2hlbiBJIGRpZSAodGhlIFtmaXJzdF0gSSB3aWxsIHNlZSBpbiAoaGVhdmVuKSBpcyBhIHNjb3JlIGxpc3QpLgpbIGZpcnN0IGluIF0gKCBmaXJzdCBvdXQgKS4KSGFsZiBNb29uIHRvbmlnaHQgKEF0IGxlYXN0IGl0IGlzIGJldHRlciB0aGFuIG5vIE1vb24gYXQgYWxsXS4KQSByb3BlIG1heSBmb3JtICkoIGEgdHJhaWwgaW4gYSBtYXplLgpIZWxwKCBJW20gYmVpbmcgaGVsZCBwcmlzb25lciBpbiBhIGZvcnR1bmUgY29va2llIGZhY3RvcnkpXS4KKFsgKChbKCBbIF0gKSAoICkgKCggKSldICkpIF0pLgogLgouCg==
So when I die (the [first] I will see in (heaven) is a score list).
[ first in ] ( first out ).
Half Moon tonight (At least it is better than no Moon at all].
A rope may form )( a trail in a maze.
Help( I[m being held prisoner in a fortune cookie factory)].
([ (([( [ ] ) ( ) (( ))] )) ]).
.
.