#include <cstring>
#include <cassert>
#include <utility>
#include <iostream>
#include <cstdio>
#include <iomanip>
#include <bitset>
#include <chrono>
#include <cstdlib>
#include <functional>
#include <tuple>
#include <climits>
#include <limits>
#include <deque>
#include <list>
#include <array>
#include <stack>
#include <queue>
#include <random>
#include <complex>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
 
#define init ios::sync_with_stdio(0); cin.tie(NULL);cout.tie(NULL);
#define setpr(x) cout << setprecision((x))
#define PI atan(1)*4
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define in insert
#define er erase
#define mk(a , b) { min((a) , (b)) , max((a) , (b)) }
#define flush cout.flush()
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define endc "\n"
#define MOD 998244353
#define mod(x) (x) %= MOD
 
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pld;

// #define int ll
ll gcd(ll a, ll b){
    while(true){
        if(a>b)
            swap(a,b);
        if (a == 0) 
            return b; 
        ll p = b % a  , q = a;
        a = p;
        b = q;
    }
}
 
ll powerMod(ll x,ll y){
    ll res = 1;
    x %= MOD;
    while(y > 0){
        if(y & 1)res = (res*x)%MOD;
        y = y >> 1;
        x = (x * x)%MOD;
    }
    return res%MOD;
}
 
string binary(ll s) {
    string res = "";
    while(s != 0) {
        res += (char)('0' + s % 2);
        s /= 2;
    }
    reverse(res.begin() , res.end());
    return res;
}


//  =========     /\       /|    |====/|
//      |        /  \       |    |   / |
//      |       /____\      |    |  /  |
//      |      /      \     |    | /   |
//  ========= /        \  =====  |/====|  
//  code

typedef pair<int , pii> ppi;

bool cmp(ppi p1 ,ppi p2){
    if(p1.se.se == p2.se.se){
        return p1.se.fi > p2.se.fi;
    }
    return p1.se.se > p2.se.se;
}

bool cmpp(ppi p1 ,ppi p2){
    if(p1.se.se == p2.se.se){
        return p1.se.fi > p2.se.fi;
    }
    return p1.se.se < p2.se.se;
}

int32_t main(){
    init;
    int n,i,j,k,l,p;
    cin >> n;
    vector<string> s(n);
    vector<ppi> s1,s2,s3,s4;
    
    for(i = 0; i < n; i++){
        cin >> s[i];
        p = 0;
        l = INT_MAX;
        for(j = 0; j < s[i].length(); j++){
            if(s[i][j] == '('){
                p++;
            }
            else p--;
            l = min(l , p);
        }

        if(p >= 0 && l >= 0){
            s1.pb({i , {p , l}});
        }
        if(p >= 0 && l < 0){
            s2.pb({i , {p , l}});
        }
        if(p < 0 && l < p){
            s4.pb({i , {p , l}});
        }
        if(p < 0 && l == p){
            s3.pb({i , {p , l}});
        }
    }

    p = 0;
    for(auto i : s1)p += i.se.fi;
    sort(all(s2) ,cmp);
    for(auto i : s2){
        // cout << i.se.fi << " " << i.se.se << endc;
        if(abs(i.se.se) <= p){
            p += i.se.fi;
        }
        else {
            // cout << i.fi << endc;
            cout << "No\n";
            return 0;
        }
    }
    sort(all(s4) , cmpp);

    for(auto i : s4){
        // cout << i.se.fi << " " << i.se.se << endc;
        if(abs(i.se.se) <= p){
            p += i.se.fi;
        }
        else {
            // cout << p << " " << i.se.se << endc;
            // cout << i.fi << endc;
            cout << "No\n";
            return 0;
        }
    }

    for(auto i : s3)p += i.se.fi;
    if(p == 0)cout << "Yes\n";
    else cout << "No\n";
    return 0;
}

Measured memory_bytes: 46332