#include<iostream>
#include<stack>
#include<string>
using namespace std;

bool balancedParanthesis(string s){
    stack<char>s1,s2,s3;
    for(int i=0;i<s.size();i++){
        char curChar = s[i];
        if(curChar=='('){
            s1.push(curChar);
        }
        else if(curChar==')'){
            if(s1.empty() || s1.top()!='('){
                return false;
            }
            s1.pop();
        }

        if(curChar=='['){
            s2.push(curChar);
        }
        else if(curChar==']'){
            if(s2.empty() || s2.top()!='['){
                return false;
            }
            s2.pop();
        }
        if(curChar=='{'){
            s3.push(curChar);
        }
        else if(curChar=='}'){
            if(s3.empty() || s3.top()!='{'){
                return false;
            }
            s3.pop();
        }

    }
    return s1.empty()&&s2.empty()&&s3.empty();
}

int main(){
    string expr;
    cin>>expr;
    if(balancedParanthesis(expr)==true){
        cout<<"Yes";
    }
    else{
        cout<<"No";
    }
return 0;}
