Concatenating Parenthesis Strings

No attempts yetTime limit2sMemory limit128 MB

Problem

You are given nn strings str1,str2,,strnstr_1, str_2, \ldots, str_n, each consisting of ( and ) only. Decide whether the nn strings can be arranged in some order so that their concatenation is a valid parenthesis string. You may reorder the strings, but the contents of each string stay as they are.

A valid parenthesis string is 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 inside a pair of matching parentheses is valid.
  • No other string is valid.

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

Input

The first line contains the number of strings nn (1n1001 \le n \le 100). Each of the next nn lines contains one string stristr_i (1stri1001 \le |str_i| \le 100). Every character of stristr_i is ( or ).

Output

Print Yes on the first line if a valid parenthesis string can be built, and No otherwise. Do not print the quotes.