#include <iostream>
#include <stack>
using namespace std;
stack<string> stk;
string s;
int main()
{
freopen("in.txt","r",stdin);
freopen("out.txt","w",stdout);
while(cin >> s)
{
if(s[0] == '@') break;
if(s[0] == '(') stk.push(s);
else if(s[0] == ')')
if(stk.empty())
{
cout<<"NO";
return 0;
}
else stk.pop();
}
if(!stk.empty()) cout<<"NO";
else cout<<"YES";
return 0;
}
0pts