#include <bits/stdc++.h>
using namespace std;
typedef long long lli;
typedef long double lld;
#define mod 1000000007
#define mod2 998244353
#define fori(n) for (int i = 0; i < n; i++)
#define forj(n) for (int j = 0; j < n; j++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define fast ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define endl "\n"
#define sortvec(a) sort(a.begin(), a.end())
#define watch(x) cerr << "\n" << (#x) << " is " << (x) << endl
#define cerr if(true)cerr
void print(){cout<<endl;}
template<typename T,typename... Args>
void print(T a, Args... args) {cout<<a<<" ";print(args...);}
lli llipowerp(lli x, lli y, lli p=LLONG_MAX)
{
    lli res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1) res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}
lli binarySearch(vector<int> arr, int l, int r, int x)
{
    if (r >= l)
    {
        lli mid = l + (r - l) / 2;
        if (arr[mid] == x)
            return mid;
        if (arr[mid] > x)
            return binarySearch(arr, l, mid - 1, x);
        return binarySearch(arr, mid + 1, r, x);
    }
    return -1;
}
template <typename T>
inline void printvec(vector<T> inp){
    for(auto it:inp) cout<<it<<" ";
    cout << endl;
}
//---------------------------------------------------------------------------------
bool isbc(string expr)
{
    stack<char> s;
    char x;

    // Traversing the Expression
    for (int i = 0; i < expr.length(); i++)
    {
        if (expr[i] == '(' || expr[i] == '[' || expr[i] == '{')
        {
            // Push the element in the stack
            s.push(expr[i]);
            continue;
        }

        // IF current current character is not opening
        // bracket, then it must be closing. So stack
        // cannot be empty at this point.
        if (s.empty())
            return false;

        switch (expr[i])
        {
        case ')':

            // Store the top element in a
            x = s.top();
            s.pop();
            if (x == '{' || x == '[')
                return false;
            break;

        case '}':

            // Store the top element in b
            x = s.top();
            s.pop();
            if (x == '(' || x == '[')
                return false;
            break;

        case ']':

            // Store the top element in c
            x = s.top();
            s.pop();
            if (x == '(' || x == '{')
                return false;
            break;
        }
    }

    // Check Empty Stack
    return (s.empty());
}
pair<int,int> countb(string inp)
{
    int a = 0;
    int b=0;

    fori(inp.size())
    {
        if (inp[i] == '(')
            a++;
        else
            b++;
    }
    return mp(a,b);
}
pair<int,int> foo(string expr){
    stack<char> s;
    char x;

    // Traversing the Expression
    for (int i = 0; i < expr.length(); i++)
    {
        if (expr[i] == '(')
        {
            // Push the element in the stack
            s.push(expr[i]);
            continue;
        }

        else{
            if(!s.empty() && s.top()=='(') s.pop();
            else s.push(')');
        }
        


        
    }
    string ans="";
    while(!s.empty()){
        ans=s.top()+ans;
        s.pop();
    }
    return countb(ans);
}

int main(){
    lli n;
    cin>>n;
    vector<string> s(n);
    vector<pair<int,string>> vals;
    fori(n) cin>>s[i];
    vector<string> pref;
    vector<string> suff;
    fori(n){
        auto p = foo(s[i]);
        if(p.S==0) pref.pb(s[i]);
        else if(p.F==0) suff.pb(s[i]);
        else vals.pb(mp(p.F-p.S,s[i]));
    }
   // printvec(pref);
    //printvec(suff);


    sort(vals.rbegin(),vals.rend());
    string check="";
    fori(pref.size()) check+=pref[i];
    fori(vals.size()) check+=vals[i].S;
    fori(suff.size()) check += suff[i];
    //print(check);
    if(isbc(check)) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

    
  
       
}

Measured memory_bytes: 68532