#include <stdio.h>

/** Application main entry point. */
int main (
  int     argc,
  char  * argv[ ]
  )
{
  char    stk[ 128 ];
  char  * sp = stk;
  int     fl = 1, lfs = 1;

  for ( ; ; )
  {
    const int ch = getchar ( );

    if ( lfs && ch == '.' ) break ;
    lfs = !!( ch == '\n' );
    if ( ch == '.' )
    {
      puts ( fl && sp == stk ? "yes" : "no" );
      fl = 1; sp = stk;
    }

    if ( fl && ch == '(' ) *( sp++ ) = ')';
    if ( fl && ch == ')' ) fl = !!( ( sp != stk ) && ( *( --sp ) == ch ) );
    if ( fl && ch == '[' ) *( sp++ ) = ']';
    if ( fl && ch == ']' ) fl = !!( ( sp != stk ) && ( *( --sp ) == ch ) );
  }

  return ( 0 );
}