#include <iostream>
#include <cstdlib>
#include <stack>
#include <string>
using namespace std;
bool Ismatch(string n) {
stack<char> a;
for (int i = 0; i < n.size(); ++i) {
if (n[i] != ')'&&n[i] != '['&&n[i] != '{') a.push(n[i]);
else {
switch (n[i]) {
case ')':
while (a.top() != '(') {
a.pop();
if (a.empty())
return false;
}
a.pop();
break;
case ']':
while (a.top() != '[') {
a.pop();
if (a.empty())
return false;
}
a.pop();
break;
case '}':
while (a.top() != '{') {
a.pop();
if (a.empty())
return false;
}
a.pop();
break;
}
}
}
if (a.empty())
return true;
else
return false;
}
int main() {
string str;
cin >> str;
if (Ismatch(str))
cout << "Yes" << endl;
else
cout << "No" << endl;
system("pause");
return 0;
}