Example

Input

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


Output

Yes
#include <bits/stdc++.h>

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

using namespace std;

const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};

using pii=pair<int,int>;

pii normalize(string s){
	int n=s.size();
	string res="";
	rep(i,n){
		if(s[i]==')' &&  !res.empty() && res.back()=='(')
			res.pop_back();
		else
			res+=s[i];
	}
	pii ret=make_pair(0,0);
	for(auto &c:res){
		if(c==')')
			ret.first++;
		else
			ret.second++;
	}
	return ret;
}

vector<pii> ll,rr;

int main(void){
	int n;
	cin >> n;
	rep(i,n){
		string s;
		cin >> s;
		pii cur=normalize(s);
		int r=cur.first,l=cur.second;
		if(r<=l)
			ll.push_back(make_pair(r,l));
		else
			rr.push_back(make_pair(l,r));
	}

	bool ok=true;
	int ld=0,rd=0;
	sort(_all(ll)),sort(_all(rr));

	for(auto &it:ll){
		if(ld-it.first<0) ok=false;
		ld+=it.second-it.first;
	}

	for(auto &it:rr){
		if(rd-it.first<0) ok=false;
		rd+=it.second-it.first;
	}

	if(ok&&ld==rd)
		puts("Yes");
	else
		puts("No");

	return 0;
}