A pipeline config parser needs a pre-flight check: are the brackets in each
config line balanced? Consider only ( ) [ ] { } — every other character is
ignored. A line is VALID when every opening bracket is closed by the matching
type in the correct order.
Input Format:
Line 1: n (number of config lines)
Lines 2 to n+1: one config line each (may contain spaces; may be empty of brackets)
Output Format:
One line per config line: VALID or INVALID