Example

Input

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


Output

Yes
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long  ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef double ld;
typedef complex<ld> Point;
const ll INF = mod * mod;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
typedef vector<int> vec;

bool comp(P a, P b) {
	if (a.first - a.second != b.first - b.second)return a.first - a.second > b.first - b.second;
	if (a.first != b.first)return a.first > b.first;
	return a.second > b.second;
}

void solve() {
	int n; cin >> n;
	vector<P> l,r;
	int sum = 0;
	rep(i, n) {
		string s; cin >> s;
		int mi = mod; int c = 0;
		int m = s.length();
		rep(j, m) {
			if (s[j] == ')')c--;
			else c++;
			mi = min(mi, c);
		}
		sum += c;
		if (c > 0) {
			l.push_back({ c,mi });
		}
		else {
			r.push_back({ c,mi });
		}
		//cout << " " << c << " " << mi << endl;
	}
	if (sum != 0) {
		cout << "No" << endl; return;
	}
	int cur = 0;
	int len = l.size();
	vector<bool> used(len, false);
	rep(i, len) {
		rep(j, len) {
			if (used[j])continue;
			if (l[j].second + cur >= 0) {
				used[j] = true;
				cur += l[j].first;
				break;
			}
		}
	}
	rep(i, len)if (!used[i]) {
		cout << "No" << endl; return;
	}
	sort(r.begin(), r.end(), comp);
	len = r.size(); used.clear(); used.resize(len, false);
	/*rep(i, len) {
		cout << r[i].first << " " << r[i].second << endl;
	}*/
	rep(i, len) {
		rep(j, len) {
			if (used[j])continue;
			if (r[j].second + cur >= 0) {
				used[j] = true;
				cur += r[j].first;
				break;
			}
		}
	}
	rep(i, len)if (!used[i]) {
		cout << "No" << endl; return;
	}

	cout << "Yes" << endl;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(5);
	//while (cin >> w>>h>>n,n)solve();
	solve();
	//stop
	return 0;
}

