#include"SqStack.h"
#include <iostream>
using namespace std;
Status Matching()
{
/***********Begin**************/
sqStack Q;
InitStack (Q);
char a,b,c;
while(1){
cin>>a;
if(a=='#')
break;
if(a=='['||a==']'||a=='('||a==')')
{ b=GetTop(Q);
if((b=='('&&a==')')||(b=='['&&a==']'))
{Pop(Q,c);}
else
{Push(Q,a);}
}
}
if(StackEmpty(Q))
return 1;
else
return 0;
/***********End**************/
}
int main()
{
/***********Begin**************/
bool flag;
flag = Matching();
if (flag)cout << "Yes";
else cout << "No";
/***********End**************/
return 0;
}