#icpc2014springe. [icpc2014spring_e]Parentheses

[icpc2014spring_e]Parentheses

MathJax.Hub.Config({ tex2jax: { inlineMath: [["","",""], ["\\(","\\)"]], processEscapes: true }}); blockquote { font-family: Menlo, Monaco, "Courier New", monospace; color: #333333; display: block; padding: 8.5px; margin: 0 0 9px; font-size: 12px; line-height: 18px; background-color: #f5f5f5; border: 1px solid #ccc; border: 1px solid rgba(0, 0, 0, 0.15); -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; white-space: pre; white-space: pre-wrap; word-break: break-all; word-wrap: break-word; }

Problem Statement

You are given nn 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 nn 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 AA and BB are valid, then the concatenation of AA and BB is valid.

  • If AA is valid, then the string obtained by putting AA in a pair of matching parentheses is valid.

  • Any other string is not valid.

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


Input

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

Output

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


Sample Input 1

3
()(()((
))()()(()
)())(())```

### Output for the Sample Input 1

```plain
Yes```

* * *

### Sample Input 2

```plain
2
))()((
))((())(```

### Output for the Sample Input 2

```plain
No```

* * *

### Source Name

[Japan Alumni Group Spring Contest 2014](http://acm-icpc.aitea.net/index.php?2013%2FPractice%2F%BD%D5%A5%B3%A5%F3%A5%C6%A5%B9%A5%C8%2F%B0%C6%C6%E2)

* * *