import java.util.*;
import java.io.*;


/**
 * Created by IntelliJ IDEA.
 * User: m09aya
 * Date: 25.11.2009
 * Time: 17:15:27
 * To change this template use File | Settings | File Templates.
 */
public class skobki {
    public static void main ( String [] args ) throws Exception {
        Scanner in = new Scanner (new File("brackets.in"));
        PrintWriter out = new PrintWriter (new File ("brackets.out"));
        LinkedList<Character> l = new LinkedList<Character>();
        String s = in.next();
        int n = s.length();
        l.add(0,'q');
        for (int i=0; i<n;i++) {
             if((l.get(0)=='(')&(s.charAt(i)==')')|
                (l.get(0)=='{')&(s.charAt(i)=='}')|
                (l.get(0)=='[')&(s.charAt(i)==']')){l.remove(0); }

            else{l.add(0, s.charAt(i) ); }


                  }
        if (l.get(0)=='q'){out.print("YES");} else{out.print("NO");}

        in.close(); out.close();



}
}
