Checking if a Parenthesization is Valid