Example

Input

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


Output

Yes
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-12;

//int N, M, K, T, H, W, L, R;
long long int N, M, K, T, H, W, L, R;


int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	cin >> N;
	vector<string>s(N);
	for (auto &i : s)cin >> i;
	vector<int>mi(N, 0);
	vector<int>sum(N, 0);
	for (int i = 0; i < N; i++) {
		int box = 0;
		for (auto j : s[i]) {
			if (j == '(')box++;
			else box--;
			mi[i] = min(mi[i], box);
		}
		sum[i] = box;
	}
	vector<pair<int, int>>l;
	vector<pair<int, int>>r;
	for (int i = 0; i < N; i++) {
		if (sum[i] >= 0) {
			l.emplace_back(mi[i], sum[i]);
		}
		else {
			mi[i] = 0;
			sum[i] = 0;
			reverse(s[i].begin(), s[i].end());
			int box = 0;
			for (auto &j : s[i]) {
				if (j == ')')box++;
				else box--;
				mi[i] = min(mi[i], box);
			}
			sum[i] = box;
			r.emplace_back(mi[i], sum[i]);
		}
	}
	sort(l.rbegin(), l.rend());
	sort(r.rbegin(), r.rend());
	int lsum = 0, rsum = 0;
	bool flag = true;
	for (auto i : l) {
		if (i.first + lsum < 0)flag = false;
		lsum += i.second;
	}
	for (auto i : r) {
		if (i.first + rsum < 0)flag = false;
	
		rsum += i.second;
	}
	if (lsum != rsum)flag = false;
	if (flag)cout << "Yes\n";
	else cout << "No\n";
}
