Example

Input

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


Output

Yes
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cmath>
#include <complex>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <cstdint>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
#define MP make_pair
#define PB push_back
#define inf 1000000007
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
 
template<class T> inline bool chmax(T &a, T b){
    if(a<b){
        a = b;
        return true;
    }
    return false;
}

template<class T> inline bool chmin(T &a, T b){
    if(a>b){
        a = b;
        return true;
    }
    return false;
}

int main(){
    int n;
    cin >> n;
    vector<string> s(n);
    rep(i,n)cin >> s[i];
    vector<pair<int,int> > p,q;
    int sm = 0;
    bool flag = 1;
    rep(i,n){
        int c = 0;
        int mi = 0;
        rep(j,s[i].size()){
            if(s[i][j]=='('){
                c++;
                sm++;
            }else{
                c--;
                sm--;
            }
            chmin(mi,c);
            if(mi!=0)flag = 0;
        }
        if(c>0){
            p.push_back(MP(mi,c));
        }else{
            q.push_back(MP(mi,c));
        }
    }
    if(sm!=0){
        cout << "No\n";
        return 0;
    }
    if(flag){
        cout << "Yes\n";
        return 0;
    }
    int d = 0;
    vector<pair<int,int> > r;
    for(auto x:p){
        if(x.first==0){
            d += x.second;
        }else{
            r.push_back(x);
        }
    }
    if(d==0){
        cout << "No\n";
        return 0;
    }
    sort(r.rbegin(),r.rend());
    for(auto x:r){
        if(d+x.first<0){
            cout << "No\n";
            return 0;
        }else{
            d += x.second;
        }
    }
    pair<int,int> las=MP(inf,inf);
    int qid = -1;
    rep(i,q.size()){
        if(q[i].first==q[i].second){
            if(chmin(las,q[i])){
                qid = i;
            }
        }
    }
    if(qid==-1){
        cout << "No\n";
        return 0;
    }
    q.erase(q.begin()+qid);
    int m = q.size();
    vector<pair<int,pair<int,int> > > qq;
    rep(i,m){
        qq.push_back(MP(q[i].first+q[i].second,MP(q[i].first,q[i].second)));
    }
    sort(qq.begin(),qq.end());
    rep(i,m){
        if(d+qq[i].second.first<0){
            cout << "No\n";
            return 0;
        }else{
            d += qq[i].second.second;
        }
    }
    cout << "Yes\n";
    return 0;
}
