#include <iostream>
#include <cstring>
#include <string>
#include <stack>
using namespace std;
string s;
stack<char> stk;
bool isok(){
int l = s.length();
for(int i = 0; i < l; ++i){
switch(s[i]){
case '(':
case '[':
case '{':
stk.push(s[i]);
break;
case ')':
if(stk.empty() || stk.top() != '(') return 0;
else stk.pop();
break;
case ']':
if(stk.empty() || stk.top() != '[') return 0;
else stk.pop();
break;
case '}':
if(stk.empty() || stk.top() != '{') return 0;
else stk.pop();
break;
}
}
if(stk.empty()) return 1;
else return 0;
}
int main()
{
cin >> s;
cout << (isok() ? "Yes" : "No") << endl;
system("pause");
return 0;
}