/* 
   AOJ 1173
   The Balance of the World
   2015.4.30
 */

#include<stdio.h>
#include<stdlib.h>

struct node
{
  char val;
  struct node *next;
};

struct node *head;

void init()
{
  head = NULL;
}

int empty()
{
  return head == NULL;
}

char pop()
{
  char pop_val = head->val;
  struct node *tmp = head->next;
  free(head);
  head = tmp;
  return pop_val;
}

struct node* new(char val, struct node* next)
{
  struct node* x = malloc(sizeof *x);
  x->val = val;
  x->next = next;
  return x;
}

void push(char push_val)
{
  head = new(push_val, head);
}

void traverse()
{
  struct node *p = head;
  while(p != NULL)
    {
      printf("%c", p->val);
      p = p->next;
    }
}

void balance_checker(char *input_str)
{
  int i;
  init();

  for(i = 0; input_str[i] != '.'; i++)
    {
      switch(input_str[i])
	{
	case '(':
	case '[':
	  push(input_str[i]);
	  break;
	case ')':
	  if(empty() || pop() != '(')
	    {
	      printf("no\n");
	      return ;
	    }
	  break;
	case ']':
	  if(empty() || pop() != '[')
	    {
	      printf("no\n");
	      return ;
	    }
	  break;
	}
    }

  if(!empty())
    {
      printf("no\n");
      return ;
    }

  printf("yes\n");
  return ;
}

int main(void)
{
  char input_str[101];
  while(1)
    {
      gets(input_str);
      if(input_str[0] == '.' && input_str[1] == '\0')
	{
	  break;
	}
      balance_checker(input_str);
    }
  return 0;
}