Example

Input

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


Output

Yes
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define rep1(i,n) for(int i=1;i<=(n);++i)
#define ALL(c) (c).begin(),(c).end()
typedef pair<int,int> P;
vector<P> pl,mi;
int main(){
	int n;
	cin >> n;
	rep(i,n){
		string s;
		cin >> s;
		int now=0,mn=0;
		rep(j,s.size()){
			if(s[j]=='(') now++;
			else now--;
			mn=min(mn,now);
		}
		int a=-mn,b=now-mn;
		if(b-a>0) pl.push_back(P(a,b));
		else mi.push_back(P(b,a));
	}
	int now=0;
	sort(ALL(pl));
	sort(ALL(mi),greater<P>());
	rep(i,pl.size()){
		if(now<pl[i].first){
			cout << "No" << endl;
			return 0;
		}
		now+=(pl[i].second-pl[i].first);
	}
	rep(i,mi.size()){
		if(now<mi[i].second){
			cout << "No" << endl;
			return 0;
		}
		now+=(mi[i].first-mi[i].second);
	}
	if(now==0) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}