시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
2 초 128 MB 139 14 14 22.222%

문제

You are given \(n\) strings \(\mathit{str}_1, \mathit{str}_2, \ldots, \mathit{str}_n\), each consisting of ( and ). The objective is to determine whether it is possible to permute the \(n\) strings so that the concatenation of the strings represents a valid string.

Validity of strings are defined as follows:

  • The empty string is valid.

  • If \(A\) and \(B\) are valid, then the concatenation of \(A\) and \(B\) is valid.

  • If \(A\) is valid, then the string obtained by putting \(A\) in a pair of matching parentheses is valid.

  • Any other string is not valid.

For example, "()()" and "(())" are valid, while "())" and "((()" are not valid.

입력

The first line of the input contains an integer \(n\) (\(1 \leq n \leq 100\)), representing the number of strings. Then \(n\) lines follow, each of which contains \(\mathit{str}_i\) (\(1 \leq \lvert \mathit{str}_i \rvert \leq 100\)). All characters in \(\mathit{str}_i\) are ( or ).

출력

Output a line with "Yes" (without quotes) if you can make a valid string, or "No" otherwise.

예제 입력

3
()(()((
))()()(()
)())(())

예제 출력

Yes

예제 입력 2

2
))()((
))((())(

예제 출력 2

No

힌트