import java.util.*;
import java.lang.*;
import java.io.*;
class Ideone
{
public static class stack
{
char arr[] = new char[10];
int current;
stack(){current = 0;};
void push(char x)
{
arr[current] = x;
current++;
}
void pop()
{
current--;
}
char back()
{
return arr[current-1];
}
int size()
{
return current;
}
};
{
Scanner input
= new Scanner
(System.
in); brace = input.nextLine();
stack x = new stack();
char a = brace.charAt(0);
if(a == '(' || a == '{' || a== '[')
{
for(int i=0;i<brace.length();i++)
{
a = brace.charAt(i);
if(a == '(' || a == '{' || a== '[')
x.push(a);
else if(Math.
abs(a
- x.
back()) < 3 && x.
size() != 0) {
x.pop();
} else
{
}
}
if(x.size() == 0)
{
} else System.
out.
println("No"); }
else
{
}
}
}
aW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgpjbGFzcyBJZGVvbmUKewoJcHVibGljIHN0YXRpYyBjbGFzcyBzdGFjawoJewoJCWNoYXIgYXJyW10gPSBuZXcgY2hhclsxMF07CgkJaW50IGN1cnJlbnQ7CgkJc3RhY2soKXtjdXJyZW50ID0gMDt9OwoJCXZvaWQgcHVzaChjaGFyIHgpCgkJewoJCQlhcnJbY3VycmVudF0gPSB4OwoJCQljdXJyZW50Kys7CgkJfQoJCXZvaWQgcG9wKCkKCQl7CgkJCWN1cnJlbnQtLTsKCQl9CgkJY2hhciBiYWNrKCkKCQl7CgkJCXJldHVybiBhcnJbY3VycmVudC0xXTsKCQl9CgkJaW50IHNpemUoKQoJCXsKCQkJcmV0dXJuIGN1cnJlbnQ7CgkJfQoJfTsKCXB1YmxpYyBzdGF0aWMgdm9pZCBtYWluIChTdHJpbmdbXSBhcmdzKSB0aHJvd3MgamF2YS5sYW5nLkV4Y2VwdGlvbgoJewoJCVN0cmluZyBicmFjZTsKCQlTY2FubmVyIGlucHV0ID0gbmV3IFNjYW5uZXIoU3lzdGVtLmluKTsKCQlicmFjZSA9IGlucHV0Lm5leHRMaW5lKCk7CgkJc3RhY2sg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