Example

Input

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


Output

Yes
#include <bits/stdc++.h>
#define FOR(i,k,n) for(int i=(k);i<(int)(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(x) begin(x),end(x)

using namespace std;

pair<int,bool> solve(const vector<pair<int,int>>& v) {
  int sh = 0;
  for (auto p : v) {
    int d, h;
    tie(d, h) = p;
    if (d > sh) return make_pair(0, false);
    sh += h;
  }
  return make_pair(sh, true);
}

int main() {
  int n;
  cin>>n;
  vector<pair<int,int>> vp;
  vector<pair<int,int>> vn;
  REP(i,n) {
    string s;
    cin>>s;
    int h = 0;
    int d = 0;
    for(char c:s) {
      if (c == '(') ++h;
      else --h;
      d = min(d, h);
    }
    if (h >= 0) vp.emplace_back(-d, h);
    else vn.emplace_back(h-d, -h);
  }
  sort(ALL(vp));
  sort(ALL(vn));
  int h1, h2;
  bool v1, v2;
  tie(h1, v1) = solve(vp);
  tie(h2, v2) = solve(vn);
  if (h1 != h2 || !v1 || !v2) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
  return 0;
}