//-_-Author:: SOURAV BISWAS
//-_-Dept-Electronics & Communication
//-_-Institution:: Jalpaiguri Government Engineering College
//-_-***********EAT____SLEEP____CODE____REPEAT***************
//_-_PUBG-Ultra$BisWas
//-__Number of leading zeroes: builtin_clz(x)
//_-_Number of trailing zeroes : builtin_ctz(x)
//-_-Number of 1-bits: __builtin_popcount(x)
#include <bits/stdc++.h>
using namespace std;
#define NIL -1
#define MAX 100
#define ll long long int
#define dd double
#define sz(x) (ll)x.size()
#define all(x) (x.begin(),x.end())
#define fmp(a,x) for(auto &a:x)
#define frv(i,a,b)  for(ll i=a;i<=b;i++)
#define fr0(i,a)   for(ll i=0;i<a;i++)
#define frr(i,a,b) for(ll i=b;i>=a;i--)
#define frr1(i,a)   for(ll i=a-1;i>=0;i--)
#define sa(a,n) sort(a,a+n)
#define sd(a,n) sort(a,a+n,greater<ll>())
#define sva(a) sort(a.begin(),a.end())
#define svd(a) sort(a.begin(),a.end(),greater<ll>())
#define cazz ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define mod (ll)(1000000007)
#define tc(t) int t;cin >>t;while(t--)
#define pb(i) push_back(i)
#define rr return 0
ll const maxn=1e5;
const int INF = 1e9 + 10;
ll add(ll a,ll b){
    return ((a%mod)+(b%mod))%mod;
}
ll mul(ll a,ll b){
    return ((a%mod)*(b%mod))%mod;
}
ll powm(ll x,ll n,ll M)
{
    ll result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=(result * x)%M;
        x=(x*x)%M;
        n=n/2;
    }
    return result;
}
ll modinverse(ll a, ll m){
    return powm(a,m-2,m);
}
bool comp(int a, int b)
{
    return (a < b);
}
void divisors(ll n){
    vector<ll>v;
    for (ll i=1; i<=sqrt(n); i++){
        if (n%i == 0){
            if (n/i == i)
                v.pb(i);
            else
            v.pb(i);
            v.pb(n/i);
        }
    }
}
bool isPowerOfTwo(ll x)
{
     // First x in the below expression is
     // for  the case when x is 0
     return x && (!(x & (x - 1)));
}
ll computeXOR(ll n){
    if (n % 4 == 0)
        return n;
    if (n % 4 == 1)
        return 1;
    if (n % 4 == 2)
        return n + 1;
    else
        return 0;
}
vector<ll> sieve(ll n) {
    bool prim[n+1];
    memset(prim, true, sizeof(prim));

    for (ll p=2; p*p<=n; p++) {
        if (prim[p] == true) {
            for (int i=p*p; i<=n; i += p)
                prim[i] = false;
        }
    }
    vector<ll>v;
    for(int i=2;i<=n;i++)if(prim[i])v.push_back(i);
    return v;
}
bool isPrime(ll n){
    if (n <= 1)
        return false;
    for (ll i = 2; i < n; i++)
        if (n % i == 0)
            return false;

    return true;
}
ll sumofdigits(ll n){
    ll c=0;
    while(n>0){
        c++;
        n/=10;
    }
    return c;
}
ll lg2(ll n){
	int cnt=0;
	while(n!=1){
		n/=2;
		cnt++;
	}
	return cnt;
}
bool cmp(string a,string b){
	return a.size()<b.size();
}
ll divisor(ll a,ll b){
    return (a%b == 0)? abs(b) : divisor(b,a%b);
}
ll l_p_n_n(ll N)
    {
        //changing all right side bits to 1.
        N = N| (N>>1);
        N = N| (N>>2);
        N = N| (N>>4);
        N = N| (N>>8);
                return (N+1)>>1;

}
// bool check(int mid, int array[], int n, int K)
// {
//     int count = 0;
//     int sum = 0;
//     for (int i = 0; i < n; i++) {

//         // If individual element is greater
//         // maximum possible sum
//         if (array[i] > mid)
//             return false;

//         // Increase sum of current sub - array
//         sum += array[i];

//         // If the sum is greater than
//         // mid increase count
//         if (sum > mid) {
//             count++;
//             sum = array[i];
//         }
//     }
//     count++;

//     // Check condition
//     if (count <= K)
//         return true;
//     return false;
// }

// // Function to find maximum subarray sum
// // which is minimum
// int solvee(int array[], int n, int K)
// {
//     int start = 1;
//     int end = 0;

//     for (int i = 0; i < n; i++) {
//         end += array[i];
//     }

//     // Answer stores possible
//     // maximum sub array sum
//     int answer = 0;
//     while (start <= end) {
//         int mid = (start + end) / 2;

//         // If mid is possible solution
//         // Put answer = mid;
//         if (check(mid, array, n, K)) {
//             answer = mid;
//             end = mid - 1;
//         }
//         else {
//             start = mid + 1;
//         }
//     }

//     return answer;
// }
ll solve(){
    ll n,c=0,o=0;
    cin>>n;
    string s;
    cin>>s;
    stack<char>st;
    for(ll i=0;i<n;i++){
        if(s[i]=='(')o++;
        else c++;
    }
    if(o!=c)cout<<"No"<<endl;
    else{
        st.push(s[0]);
        for(ll i=1;i<n;i++){
            if(s[i]==')'){
                if(st.top()=='('){
                    st.pop();
                }
            }
            else{
            st.push(s[i]);
            }
        }
        if(st.size()<=2)cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
    // cout<<st.size();
}
int main(){
    cazz
    // tc(t){
        solve();
    // }
    rr;
}


#include <bits/stdc++.h>
using namespace std;
#define NIL -1
#define MAX 100
#define ll long long int
#define dd double
#define cazz ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define mod (ll)(998244353)
#define tc(t) int t;cin >>t;while(t--)
#define pb(i) push_back(i)
#define rr return 0
int main(){
    cazz
    ll n,cnt=0;
    cin>>n;
    string s;
    cin>>s;
    vector<char>v;
    vector<char>v1;
    if(n%2==1)cout<<"No";
    else{
        for(ll i=0;i<n;i++){
            if(s[i]=='(')v.push_back(s[i]);
            else if(s[i]==')') v1.push_back(s[i]);
            else if(s[i]=='(' and s[i+1]==')'){
                i++;
                if(i!=0){
                v.pop_back();
                }
                else if((i+1)!=n-1){
                v1.pop_back();
                }
            }
        }
        if(v.size()>1 or v1.size()>1)cout<<"No";
        else cout<<"Yes";
    }
}


#include <iostream>
#include <cstdio>
#include <stack>
using namespace std;
stack<int>q;
/*int StackLength(stack S)
{
	//S.top -- ;  //这个地方是不能修改栈里面的值的
	return S.top +1;
}*/
int main()
{
    int i,j;
    int cnt=0,num1=0,num2=0,flag=0;
    string ch;
    scanf("%d",&i);
    cin>>ch;
    for(j=0;j<i;j++)
    {
    	if(ch[j]==')')
    	num1++;
    	else
    	num2++;
    }
    if(i==2)
    {
    	printf("Yes\n");
    	return 0;
    }
    if(i%2==1)
    {
    	printf("No\n");
    	return 0;
    }
    /*if(ch[0]==')'&&ch[1]==')')
    {
    	printf("No\n");
    	return 0;
    }*/
    for(j=0;j<i;j++)
    {   cnt++;
        if(ch[j]=='(')
        {
        	q.push(cnt);
        	if((num2==0)&&(num1==2||num1==0)&&flag==0)
        	{
        		printf("Yes\n");
        		return 0;
        	}
        	else if(num1==0&&num2==2&&flag==0)
        	{
        		printf("Yes\n");
        		return 0;
        	}
        	if(flag==1)
        	{
        		q.pop();
        		num1--;num2--;
        	}
        }
        if(ch[j]==')')
        {
        	if((num2==0)&&(num1==2||num1==0)&&flag==0)
        	{
        		printf("Yes\n");
        		return 0;
        	}
        	else if(num1==0&&num2==2&&flag==0)
        	{
        		printf("Yes\n");
        		return 0;
        	}
            if(flag==0&&q.empty())
            {
            	flag=1;
            }
            else if(flag==1&&q.empty())
            {
            	printf("No\n");
            	return 0;
            }
            else
            {
            	q.pop();
            	num1--;num2--;
            }
         }
    }
    printf("No\n");
    return 0;
}


#include <iostream>
#include <cstdio>
#include <stack>
using namespace std;
stack<int>q;
/*int StackLength(stack S)
{
	//S.top -- ;  //这个地方是不能修改栈里面的值的
	return S.top +1;
}*/
int main()
{
    int i,j;
    int cnt=0,num1=0,num2=0,flag=0;
    string ch;
    scanf("%d",&i);
    cin>>ch;
    for(j=0;j<i;j++)
    {
    	if(ch[j]==')')
    	num1++;
    	else
    	num2++;
    }
    if(i==2)
    {
    	printf("Yes\n");
    	return 0;
    }
    if(i%2==1)
    {
    	printf("No\n");
    	return 0;
    }
    /*if(ch[0]==')'&&ch[1]==')')
    {
    	printf("No\n");
    	return 0;
    }*/
    for(j=0;j<i;j++)
    {   cnt++;
        if(ch[j]=='(')
        {
        	q.push(cnt);
        	if((num2==0)&&(num1==2||num1==0)&&flag==0)
        	{
        		printf("Yes\n");
        		return 0;
        	}
        	else if(num1==0&&(num2==2||num2==0)&&flag==0)
        	{
        		printf("Yes\n");
        		return 0;
        	}
        	if(flag==1)
        	{
        		q.pop();
        		num1--;num2--;
        	}
        }
        if(ch[j]==')')
        {
        	if((num2==0)&&(num1==2||num1==0)&&flag==0)
        	{
        		printf("Yes\n");
        		return 0;
        	}
        	else if(num1==0&&(num2==2||num2==0)&&flag==0)
        	{
        		printf("Yes\n");
        		return 0;
        	}
            if(flag==0&&q.empty())
            {
            	flag=1;
            }
            else if(flag==1&&q.empty())
            {
            	printf("No\n");
            	return 0;
            }
            else
            {
            	q.pop();
            	num1--;num2--;
            }
         }
		if((num2==0)&&(num1==2||num1==0)&&flag==0)
        	{
        		printf("Yes\n");
        		return 0;
        	}
        	else if(num1==0&&(num2==2||num2==0)&&flag==0)
        	{
        		printf("Yes\n");
        		return 0;
        	}
    }
    printf("No\n");
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
using namespace std;
stack<int>q;
/*int StackLength(stack S)
{
	//S.top -- ;  //����ط��ǲ����޸�ջ�����ֵ��
	return S.top +1;
}*/
int main()
{
    int i,j;
    int cnt=0,num1=0,num2=0,flag=0;
    string ch;
    scanf("%d",&i);
    cin>>ch;
    for(j=0;j<i;j++)
    {
    	if(ch[j]==')')
    	num1++;
    	else
    	num2++;
    }
    if(i==2)
    {
    	printf("Yes\n");
    	return 0;
    }
    int temp;
    temp=abs(num1-num2);
    if(temp!=2||temp!=0)
	{
		printf("No\n");
		return 0;
	}
    /*if(ch[0]==')'&&ch[1]==')')
    {
    	printf("No\n");
    	return 0;
    }*/
    for(j=0;j<i;j++)
    {   cnt++;
        if(ch[j]=='(')
        {
        	q.push(cnt);
        }
        if(ch[j]==')')
        {
            if(flag==0&&q.empty())
            {
            	flag=1;q.push(cnt);
            }
            else if(flag==1&&q.empty())
            {
            	printf("No\n");
            	return 0;
            }
            else
            {
            	q.pop();
            	num1--;num2--;
            }
         }
		if((num2==0)&&(num1==2||num1==0)&&flag==0)
        {
       		printf("Yes\n");
       		return 0;
       	}
       	else if(num1==0&&(num2==2||num2==0)&&flag==0)
       	{
       		printf("Yes\n");
       		return 0;
       	}
    }
    printf("No\n");
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int mm,num=0,n;
	char ch[200050];
	cin>>n>>ch;
	int i,j;
	mm=n;
	for(i=0;i<n;i++)
	{
		if(ch[i]=='(')
		num++;
		else
		num--;
		mm=min(mm,num);
	}
	if(num==0&&mm>=-1)
	printf("Yes\n");
	else
	printf("No\n");
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
stack<int>q;
int main()
{
    int i,j;
    int cnt=0,num1=0,num2=0,flag=0;
    string ch;
    scanf("%d",&i);
    cin>>ch;
    for(j=0;j<i;j++)
    {
    	if(ch[j]==')')
    	num1++;
    	else
    	num2++;
    }
    if(i==2)
    {
    	printf("Yes\n");
    	return 0;
    }
    int temp;
    temp=abs(num1-num2);
    if(temp!=2&&temp!=0)
	{
		printf("No\n");
		return 0;
	}
    for(j=0;j<i;j++)
    {   cnt++;
        if(ch[j]=='(')
        {
        	q.push(cnt);
        }
        if(ch[j]==')')
        {
            if(flag==0&&q.empty())
            {
            	flag=1;q.push(cnt);num1--;num2++;continue;
            }
            else if(flag==1&&q.empty())
            {
            	printf("No\n");
            	return 0;
            }
            q.pop();
            num1--;num2--;
        }
		if((num2==0)&&(num1==2||num1==0))
        {
       		printf("Yes\n");
       		return 0;
       	}
       	else if(num1==0&&(num2==2||num2==0))
       	{
       		printf("Yes\n");
       		return 0;
       	}
    }
    printf("No\n");
    return 0;
}


#include <iostream>
#include <cstdio>
#include <stack>
using namespace std;
stack<int>q;
/*int StackLength(stack S)
{
	//S.top -- ;  //����ط��ǲ����޸�ջ�����ֵ��
	return S.top +1;
}*/
int main()
{
    int i,j;
    int cnt=0,num1=0,num2=0,flag=0;
    string ch;
    scanf("%d",&i);
    cin>>ch;
    for(j=0;j<i;j++)
    {
    	if(ch[j]==')')
    	num1++;
    	else
    	num2++;
    }
    if(i==2)
    {
    	printf("Yes\n");
    	return 0;
    }
    if(i%2==1)
    {
    	printf("No\n");
    	return 0;
    }
    /*if(ch[0]==')'&&ch[1]==')')
    {
    	printf("No\n");
    	return 0;
    }*/
    for(j=0;j<i;j++)
    {   cnt++;
        if(ch[j]=='(')
        {
        	q.push(cnt);

        	if(flag==1)
        	{
        		q.pop();
        		num1--;num2--;
        	}
        }
        if(ch[j]==')')
        {
            if(flag==0&&q.empty())
            {
            	flag=1;
            }
            else if(flag==1&&q.empty())
            {
            	printf("No\n");
            	return 0;
            }
            else
            {
            	q.pop();
            	num1--;num2--;
            }
         }
		if((num2==0)&&(num1==2||num1==0)&&flag==0)
        {
       		printf("Yes\n");
       		return 0;
       	}
       	else if(num1==0&&(num2==2||num2==0)&&flag==0)
       	{
       		printf("Yes\n");
       		return 0;
       	}
    }
    printf("No\n");
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
using namespace std;
stack<int>q;
/*int StackLength(stack S)
{
	//S.top -- ;  //����ط��ǲ����޸�ջ�����ֵ��
	return S.top +1;
}*/
int main()
{
    int i,j;
    int cnt=0,num1=0,num2=0,flag=0;
    string ch;
    scanf("%d",&i);
    cin>>ch;
    for(j=0;j<i;j++)
    {
    	if(ch[j]==')')
    	num1++;
    	else
    	num2++;
    }
    if(i==2)
    {
    	printf("Yes\n");
    	return 0;
    }
    int temp;
    temp=abs(num1-num2);
    if(temp!=2||temp!=0)
	printf("No\n");
    /*if(ch[0]==')'&&ch[1]==')')
    {
    	printf("No\n");
    	return 0;
    }*/
    for(j=0;j<i;j++)
    {   cnt++;
        if(ch[j]=='(')
        {
        	q.push(cnt);
        }
        if(ch[j]==')')
        {
            if(flag==0&&q.empty())
            {
            	flag=1;q.push(cnt);
            }
            else if(flag==1&&q.empty())
            {
            	printf("No\n");
            	return 0;
            }
            else
            {
            	q.pop();
            	num1--;num2--;
            }
         }
		if((num2==0)&&(num1==2||num1==0)&&flag==0)
        {
       		printf("Yes\n");
       		return 0;
       	}
       	else if(num1==0&&(num2==2||num2==0)&&flag==0)
       	{
       		printf("Yes\n");
       		return 0;
       	}
    }
    printf("No\n");
    return 0;
}


#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
    int c1=0,ii=0,jj=0,nn,num=0;
    char i;
    int cnt=0;
    cin>>nn;
    getchar();
    while(scanf("%c",&i)==1&&i!='\n')
    {
        if(i=='(')
  {
   jj++;
      num++;
        }
  if(i==')')
        {
            if(num==0){ii++;}
            else
            {
   jj--;
            num--;
            }
         }
    }
    if(num==0)
    {
        cout<<"Yes";
    }
    else if(ii==1&&jj==1)
    {
     cout<<"Yes";
 }
    else cout<<"No";
    return 0;
}


#include<bits/stdc++.h>
#define ll long long
#define all(v) v.begin(),v.end()
using namespace std;

void solve() {
	int n,mis=0;
    cin>>n;
    string s;
    cin>>s;
    if(n==1) {
        cout<<"No"<<endl;
        return;
    }
    stack<char> st;
    st.push('#');
    for(char c:s) {
        if(c=='(')
            st.push(c);
        else {
            if(st.top()!='(')
                mis++;
            else
                st.pop();
        }
    }
    if(st.size()==1 or mis==1)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
}
int main(){
	ios ::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
	int t=1;
	//cin>>t;
	while(t--) {
		solve();
	}
	return 0;
}


#include<bits/stdc++.h>
#define ll long long
#define all(v) v.begin(),v.end()
using namespace std;

void solve() {
	int n,mis=0;
    cin>>n;
    string s;
    cin>>s;
    stack<char> st;
    st.push('#');
    for(char c:s) {
        if(c=='(')
            st.push(c);
        else {
            if(st.top()!='(')
                mis++;
            else
                st.pop();
        }
    }
    if(st.size()==1 or mis==1)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
}
int main(){
	ios ::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
	int t=1;
	//cin>>t;
	while(t--) {
		solve();
	}
	return 0;
}


#include<bits/stdc++.h>
#define ll long long
#define all(v) v.begin(),v.end()
using namespace std;

void solve() {
	int n,mis=0;
    cin>>n;
    string s;
    cin>>s;
    stack<char> st;
    st.push('#');
    for(char c:s) {
        if(c=='(')
            st.push(c);
        else {
            if(st.top()!='(')
                mis++;
            else
                st.pop();
        }
    }
    if(st.size()==1 or mis==1)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
}
int main(){
	ios ::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
	int t=1;
	cin>>t;
	while(t--) {
		solve();
	}
	return 0;
}


#include<bits/stdc++.h>
#define ll long long
#define all(v) v.begin(),v.end()
using namespace std;

void solve() {
	int n,mis=0;
    cin>>n;
    string s;
    cin>>s;
    if(n==1) {
        cout<<"No"<<endl;
        return;
    }
    stack<char> st;
    st.push('#');
    for(char c:s) {
        if(c=='(')
            st.push(c);
        else {
            if(st.top()!='(')
                mis++;
            else
                st.pop();
        }
    }
    if((st.size()==1 and mis==0) or mis==1)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;

}
int main(){
	ios ::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
	int t=1;
	//cin>>t;
	while(t--) {
		solve();
	}
	return 0;
}


#include<bits/stdc++.h>
#define ll long long
#define all(v) v.begin(),v.end()
using namespace std;

void solve() {
	int n,mis=0,o=0,e=0;
    cin>>n;
    string s;
    cin>>s;
    for(char c:s)
        if(c=='(')
            o++;
        else
            e++;
    if(o!=e) {
        cout<<"No"<<endl;
        return;
    }

    stack<char> st;
    st.push('#');
    for(char c:s) {
        if(c=='(')
            st.push(c);
        else {
            if(st.top()!='(')
                mis++;
            else
                st.pop();
        }
    }
    if((st.size()==1 and mis==0) or mis==1)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;

}
int main(){
	ios ::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
	int t=1;
	//cin>>t;
	while(t--) {
		solve();
	}
	return 0;
}


#include<bits/stdc++.h>
#define ll long long
#define all(v) v.begin(),v.end()
using namespace std;

void solve() {
	int n,mis=0;
    cin>>n;
    string s;
    cin>>s;
    if(n%2==1) {
        cout<<"No"<<endl;
        return;
    }
    stack<char> st;
    st.push('#');
    for(char c:s) {
        if(c=='(')
            st.push(c);
        else {
            if(st.top()!='(')
                mis++;
            else
                st.pop();
        }
    }
    if((st.size()==1 and mis==0) or mis==1)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;

}
int main(){
	ios ::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
	int t=1;
	//cin>>t;
	while(t--) {
		solve();
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll unsigned long long
#define lnd long double
#define ff first
#define ss second
int main(){
	ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);
	int n; scanf("%d",&n);
	string s;
	cin>>s;
	int ob=0,cb=0,f=0;
	for(int i=0;i<(int)s.length();++i){
		if(s[i]=='(') ++ob;
		else ++cb;
		if(cb>ob){
			if(f==0){
				++ob;
				s.append(")");
				f=1;
			}
			else{
				printf("No\n");
				exit(0);
			}
		}
	}
	if(ob==cb) printf("Yes\n");
	else printf("No\n");
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lnd long double
#define ff first
#define ss second
int main(){
	ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);
	int n; scanf("%d",&n);
	string s;
	cin>>s;
	int ob=0,cb=0,f=0;
	for(int i=0;i<(int)s.length();++i){
		if(s[i]=='(') ++ob;
		else ++cb;
		if(cb>ob){
			if(f==0){
				--cb;
				s+=")";
				f=1;
			}
			else{
				f=2;
				break;
			}
		}
	}
	if(f<=1 and ob==cb) printf("Yes\n");
	else printf("No\n");
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lnd long double
#define ff first
#define ss second
int main(){
	ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);
	int n; scanf("%d",&n);
	string s;
	cin>>s;
	int ob=0,cb=0;
	int mn=INT_MAX;
	for(int i=0;i<(int)s.length();++i){
		if(s[i]=='(') ++ob;
		else ++cb;
		mn=min(mn,ob-cb);
	}
	if(ob==cb and mn>=-1) printf("Yes\n");
	else printf("No\n");
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lnd long double
#define ff first
#define ss second
int main(){
 int n;
    string s;
    cin >> n >> s;

    int i,c = 0,m = 0;
    for (i = 0; i < s.size(); i++) {
        c += (s[i] == '(') ? 1:-1;
        m = min(m,c);
    }
    if ((c == 0) && (m >= -1)) printf("Yes\n");
    else printf("No\n");

    return 0;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lnd long double
#define ff first
#define ss second
int main(){
	ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);
	int n; scanf("%d",&n);
	string s;
	cin>>s;
	int ob=0,cb=0,f=0;
	for(int i=0;i<(int)s.length();++i){
		if(s[i]=='(') ++ob;
		else ++cb;
		if(cb>ob){
			if(f==0){
				++ob;
				s.append(")");
				f=1;
			}
			else{
				printf("No\n");
				exit(0);
			}
		}
	}
	if(ob==cb) printf("Yes\n");
	else printf("No\n");
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lnd long double
#define ff first
#define ss second
int main(){
	//ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);
	int n; cin>>n;
	string s; cin>>s;
	int ob=0,cb=0;
	int mn=0;
	for(int i=0;i<(int)s.length();++i){
		if(s[i]=='(') ++ob;
		else ++cb;
		mn=min(mn,ob-cb);
	}
	if(ob==cb and mn>=-1) printf("Yes\n");
	else printf("No\n");
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
char a[200005];
int main()
{
    int n;
    cin>>n;
    scanf("%s", a);
    int c=0,cnt=0;
    for(int i=0;i<n;i++)
    {
        if(a[i]=='(')
        c++;
        else if(a[i]==')')
        c--;
        if(c<0)
        cnt++;
    }
    if(cnt<=1&&c==0)
    cout<<"YES";

    else
    {

        int c=0,cnt=0;
    for(int i=n-1;i>=0;i--)
    {
        if(a[i]=='(')
        c++;
        else if(a[i]==')')
        c--;
        if(c<0)
        cnt++;
    }
    if(cnt<=1&&c==0)
    cout<<"YES";
    else
    cout<<"NO";
    }
}


#include<bits/stdc++.h>
using namespace std;
char a[200005];
int main()
{
    int n;
    cin>>n;
    scanf("%s", a);
    int c=0,cnt=0;
    for(int i=0;i<n;i++)
    {
        if(a[i]=='(')
        c++;
        else if(a[i]==')')
        c--;
        if(c<0)
        cnt++;
    }
    if(cnt<=1&&c==0)
    cout<<"YES";
    else
    cout<<"NO";
}


#include<bits/stdc++.h>
using namespace std;
char a[200005];
int main()
{
    int n;
    cin>>n;
    scanf("%s", a);
    int c=0,cnt=0;
    for(int i=0;i<n;i++)
    {
        if(a[i]=='(')
        c++;
        else if(a[i]==')')
        c--;
        if(c<0)
        cnt++;
    }
    if(cnt<=2&&c==0)
    cout<<"YES";
    else
    cout<<"NO";
}


#include<bits/stdc++.h>
using namespace std;
char a[200005];
int main()
{
    int n;
    cin>>n;
    scanf("%s", a);
    int c=0,cnt=0;
    for(int i=0;i<n;i++)
    {
        if(a[i]=='(')
        c++;
        else if(a[i]==')')
        c--;
        if(c<0)
        cnt++;
    }
    if(cnt==1)
    cout<<"YES";
    else
    cout<<"NO";
}


#include<bits/stdc++.h>
using namespace std;
char a[200005];
int main()
{
    int n;
    cin>>n;
    scanf("%s", a);
    int c=0,cnt=0;
    for(int i=0;i<n;i++)
    {
        if(a[i]=='(')
        c++;
        else if(a[i]==')')
        c--;
        if(c<0)
        cnt++;
    }
    if(cnt<=1)
    cout<<"YES";
    else
    cout<<"NO";
}


#includee<bits/stdc++.h>
using namespace std;
char a[200005];
int main()
{
    int n;
    cin>>n;
    scanf("%s", a);
    int c=0,cnt=0;
    for(int i=0;i<n;i++)
    {
        if(a[i]=='(')
        c++;
        else if(a[i]==')')
        c--;
        if(c<0)
        cnt++;
    }
    if(cnt==1)
    cout<<"YES";
    else
    cout<<"NO";
}


#include<bits/stdc++.h>
using namespace std;
char a[200005];
int main()
{
    int n;
    cin>>n;
    scanf("%s", a);
    int c=0,cnt=0;
    for(int i=0;i<n;i++)
    {
        if(a[i]=='(')
        c++;
        else if(a[i]==')')
        c--;
        cnt=min(c,cnt);
    }
    if(cnt>=-1&&c==0)
    cout<<"YES";
    else
    cout<<"NO";
}


#include <bits/stdc++.h>
namespace myland{
    using namespace std;
    namespace _abbr{
        #define fi first
        #define se second
        #define pb push_back
        #define pr make_pair
        #define lb lower_bound
        #define ub upper_bound
        #define str string
        #define _1s __builtin_popcountll
        #define nth(a,l,r,k) nth_element(a+l,a+l+k-1,a+r+1)
        typedef unsigned int ui;
        typedef long long ll;
        typedef unsigned long long ull;
        typedef double db;
        typedef long double ld;
        typedef pair<int,int> pii;
        typedef pair<ll,ll> pll;
        typedef vector<int> vi;
        typedef vector<ll> vl;
        typedef vector<pii> vpii;
        typedef vector<pll> vpll;
        typedef vector<vi> vvi;
        typedef vector<vl> vvl;
        typedef vector<vpii> vvpii;
        typedef vector<vpll> vvpll;
    }using namespace _abbr;
    namespace _constant{
        const double EPS(1e-8);
        const double PI(acos(-1.0));
        const int INF(0x3f3f3f3f);
        const ll INFL(0x3f3f3f3f3f3f3f3fll);
        const int MOD(1e9+7);//998244353, 16341163, 999983, 131, 1e9 + 9
        const int dx[]={1,0,0,-1,-1,1,1,-1}, dy[]={0,-1,1,0,1,1,-1,-1};
    }using namespace _constant;
    namespace _solve{
        #define XOR int main()
        #define GG exit(0)
        #define rep(x,a,b) for(int x=a;x<=b;++x)
        #define per(x,a,b) for(int x=b;x>=a;--x)
        #define times(x) for(int cas=1,tms=(x);cas<=tms;cas++)
        #define CaseT int T;cin >> T;times(T)
        #define TCase int T;scanf("%d",&T);times(T)
        #define continue(_) if(_) continue;
        #define break(_) if(_) break;
    }using namespace _solve;
    namespace _calculate{
        bool odd(ll x){return x&1;}
        bool even(ll x){return (x&1)^1;}
        bool posi(ll x){return x>0;}
        bool nega(ll x){return x<0;}
        bool zero(ll x){return x==0;}
        bool prime(ll x){if(x<2) return 0;
            for(ll i=2;1ll*i*i<=x;i++) if(x%i==0) return 0;
            return 1;}
        ll droot(ll x){return 1+(x-1)%9;}
        ll upd(ll a, ll b){return a%b?a/b+1:a/b;};
        ll gcd(ll a, ll b){return __gcd(a, b);}
        ll lcm(ll a, ll b){return a/gcd(a, b)*b;}
        mt19937_64 rand(time(0));
        ll random(ll a, ll b){return a+rand()%(b-a+1);};
        ll bitn(ll x){ll c=0;while(x)c++,x>>=1;return c;}
        template<class T>T sqr(T x){return x*x;}
        ll qpow(ll a, ll n, ll mod = MOD){
            ll res(1);while(n){
            if(n&1) (res*=a)%=mod;
            (a*=a)%=mod;n>>=1;}
            return res%mod;}
        ll inv(ll a, ll mod = MOD){return qpow(a,mod-2, mod);}
        template<class T>void tomin(T& a,T b){if(b<a) a=b;}
        template<class T>void tomax(T& a,T b){if(b>a) a=b;}
    }using namespace _calculate;
    namespace _simple_algo{
        #define rg(a,x,y) (a+x), (a+y+1)
        #define vrg(a,x,y) (a.begin()+x),(a.begin()+y+1)
        #define all(x) (x).begin(),(x).end()
        #define rall(x) (x).rbegin(),(x).rend()
        #define clr(a,b) memset(a,b,sizeof(a))
        #define fil(a,b) fill(all(a),b)
        #define _sum(a) accumulate(a, 0ll)
        #define sz(a) (ll(a.size()))
        ll sol(const string& s){ll x=0;
            for(char c:s)x=x*10+c-48;return x;}
        string los(ll x){string s = "";
            if(x==0) return "0";
            while(x) s=char(x%10+48)+s,x/=10;
            return s;}
        bool pal(const string& s){int l = s.size();
            for(int i=0,j=l-1;i<j;i++,j--)
                if(s[i]!=s[j]) return 0;return 1;}
    }using namespace _simple_algo;
    namespace _io{
        #define FAST_IO ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
        #define bug cerr << "!!!" << endl;
        #define bugc(_) cerr << (#_) << " = " << (_) << endl;
        template<class T>void rd(T& x){cin>>x;}
        str srd(){str s;cin>>s;return s;}
        ll rd(){
            ll x=0,f=1;char ch=getchar();
            while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
            while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
            return x*f;}
        void rd(int& x){x=rd();}
        void rd(ll& x){x=rd();}
        template<class A,class B>void rd(A& a,B& b){rd(a), rd(b);}
        template<class A,class B>void rd(pair<A,B>& p){rd(p.fi, p.se);}
        template<class A,class B,class C>void rd(A& a,B& b,C& c){rd(a,b);rd(c);}
        template<class T>void wt(const T& x){cout << x << '\n';}
        template<class T>void wt(const T& x, char c){cout << x << c;}
        template<class T>void wt(const T& x, const str& s){cout << x << s;}
        template<class T>void wt(const T& x, int rnd){
            cout << fixed << setprecision(rnd) << x << '\n';}
        template<class T>void wt(const vector<T>& v){
            for(int i=0;i<sz(v);i++){cout << v[i];if(i<sz(v)-1) cout << ' ';};wt("");}
        template<class A,class B>void wt(const pair<A,B>& pr){
            cout << pr.fi << ' ' << pr.se << '\n';}
        #define out(_) wt(_),GG
    }using namespace _io;
}using namespace myland;

int n = rd();
str s = srd();

XOR{
    if(n&1) out("No");
    int cnt = 0;
    int f1 = 0, f2 = 0;
    for(char c:s){
        if(c == ')'){
            if(not cnt) f2++, cnt++;
            else cnt--;
        }
        else{
            cnt++;
        }
    }
    if(f2 > 1) out("No");
    if(f1 == 0 and f2 == 0 and cnt == 0) out("Yes");
    if(f1 == 0 and f2 == 1 and cnt == 2) out("Yes");
    out("No");
}


#include <bits/stdc++.h>
namespace myland{
    using namespace std;
    namespace _abbr{
        #define fi first
        #define se second
        #define pb push_back
        #define pr make_pair
        #define lb lower_bound
        #define ub upper_bound
        #define str string
        #define _1s __builtin_popcountll
        #define nth(a,l,r,k) nth_element(a+l,a+l+k-1,a+r+1)
        typedef unsigned int ui;
        typedef long long ll;
        typedef unsigned long long ull;
        typedef double db;
        typedef long double ld;
        typedef pair<int,int> pii;
        typedef pair<ll,ll> pll;
        typedef vector<int> vi;
        typedef vector<ll> vl;
        typedef vector<pii> vpii;
        typedef vector<pll> vpll;
        typedef vector<vi> vvi;
        typedef vector<vl> vvl;
        typedef vector<vpii> vvpii;
        typedef vector<vpll> vvpll;
    }using namespace _abbr;
    namespace _constant{
        const double EPS(1e-8);
        const double PI(acos(-1.0));
        const int INF(0x3f3f3f3f);
        const ll INFL(0x3f3f3f3f3f3f3f3fll);
        const int MOD(1e9+7);//998244353, 16341163, 999983, 131, 1e9 + 9
        const int dx[]={1,0,0,-1,-1,1,1,-1}, dy[]={0,-1,1,0,1,1,-1,-1};
    }using namespace _constant;
    namespace _solve{
        #define XOR int main()
        #define GG exit(0)
        #define rep(x,a,b) for(int x=a;x<=b;++x)
        #define per(x,a,b) for(int x=b;x>=a;--x)
        #define times(x) for(int cas=1,tms=(x);cas<=tms;cas++)
        #define CaseT int T;cin >> T;times(T)
        #define TCase int T;scanf("%d",&T);times(T)
        #define continue(_) if(_) continue;
        #define break(_) if(_) break;
    }using namespace _solve;
    namespace _calculate{
        bool odd(ll x){return x&1;}
        bool even(ll x){return (x&1)^1;}
        bool posi(ll x){return x>0;}
        bool nega(ll x){return x<0;}
        bool zero(ll x){return x==0;}
        bool prime(ll x){if(x<2) return 0;
            for(ll i=2;1ll*i*i<=x;i++) if(x%i==0) return 0;
            return 1;}
        ll droot(ll x){return 1+(x-1)%9;}
        ll upd(ll a, ll b){return a%b?a/b+1:a/b;};
        ll gcd(ll a, ll b){return __gcd(a, b);}
        ll lcm(ll a, ll b){return a/gcd(a, b)*b;}
        mt19937_64 rand(time(0));
        ll random(ll a, ll b){return a+rand()%(b-a+1);};
        ll bitn(ll x){ll c=0;while(x)c++,x>>=1;return c;}
        template<class T>T sqr(T x){return x*x;}
        ll qpow(ll a, ll n, ll mod = MOD){
            ll res(1);while(n){
            if(n&1) (res*=a)%=mod;
            (a*=a)%=mod;n>>=1;}
            return res%mod;}
        ll inv(ll a, ll mod = MOD){return qpow(a,mod-2, mod);}
        template<class T>void tomin(T& a,T b){if(b<a) a=b;}
        template<class T>void tomax(T& a,T b){if(b>a) a=b;}
    }using namespace _calculate;
    namespace _simple_algo{
        #define rg(a,x,y) (a+x), (a+y+1)
        #define vrg(a,x,y) (a.begin()+x),(a.begin()+y+1)
        #define all(x) (x).begin(),(x).end()
        #define rall(x) (x).rbegin(),(x).rend()
        #define clr(a,b) memset(a,b,sizeof(a))
        #define fil(a,b) fill(all(a),b)
        #define _sum(a) accumulate(a, 0ll)
        #define sz(a) (ll(a.size()))
        ll sol(const string& s){ll x=0;
            for(char c:s)x=x*10+c-48;return x;}
        string los(ll x){string s = "";
            if(x==0) return "0";
            while(x) s=char(x%10+48)+s,x/=10;
            return s;}
        bool pal(const string& s){int l = s.size();
            for(int i=0,j=l-1;i<j;i++,j--)
                if(s[i]!=s[j]) return 0;return 1;}
    }using namespace _simple_algo;
    namespace _io{
        #define FAST_IO ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
        #define bug cerr << "!!!" << endl;
        #define bugc(_) cerr << (#_) << " = " << (_) << endl;
        template<class T>void rd(T& x){cin>>x;}
        str srd(){str s;cin>>s;return s;}
        ll rd(){
            ll x=0,f=1;char ch=getchar();
            while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
            while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
            return x*f;}
        void rd(int& x){x=rd();}
        void rd(ll& x){x=rd();}
        template<class A,class B>void rd(A& a,B& b){rd(a), rd(b);}
        template<class A,class B>void rd(pair<A,B>& p){rd(p.fi, p.se);}
        template<class A,class B,class C>void rd(A& a,B& b,C& c){rd(a,b);rd(c);}
        template<class T>void wt(const T& x){cout << x << '\n';}
        template<class T>void wt(const T& x, char c){cout << x << c;}
        template<class T>void wt(const T& x, const str& s){cout << x << s;}
        template<class T>void wt(const T& x, int rnd){
            cout << fixed << setprecision(rnd) << x << '\n';}
        template<class T>void wt(const vector<T>& v){
            for(int i=0;i<sz(v);i++){cout << v[i];if(i<sz(v)-1) cout << ' ';};wt("");}
        template<class A,class B>void wt(const pair<A,B>& pr){
            cout << pr.fi << ' ' << pr.se << '\n';}
        #define out(_) wt(_),GG
    }using namespace _io;
}using namespace myland;

int n = rd();
str s = srd();

XOR{
    int cnt = 0;
    int f = 0;
    for(char c:s){
        if(c == '('){
            cnt++;
            if(f == 1) cnt--, f = -1;
        }
        else{
            if(not cnt and f == 1) out("No");
            if(not cnt) f = 1;
            else cnt--;
        }
    }
    out(cnt == 0 ? "Yes" : "No");
}


#include <bits/stdc++.h>
namespace myland{
    using namespace std;
    namespace _abbr{
        #define fi first
        #define se second
        #define pb push_back
        #define pr make_pair
        #define lb lower_bound
        #define ub upper_bound
        #define str string
        #define _1s __builtin_popcountll
        #define nth(a,l,r,k) nth_element(a+l,a+l+k-1,a+r+1)
        typedef unsigned int ui;
        typedef long long ll;
        typedef unsigned long long ull;
        typedef double db;
        typedef long double ld;
        typedef pair<int,int> pii;
        typedef pair<ll,ll> pll;
        typedef vector<int> vi;
        typedef vector<ll> vl;
        typedef vector<pii> vpii;
        typedef vector<pll> vpll;
        typedef vector<vi> vvi;
        typedef vector<vl> vvl;
        typedef vector<vpii> vvpii;
        typedef vector<vpll> vvpll;
    }using namespace _abbr;
    namespace _constant{
        const double EPS(1e-8);
        const double PI(acos(-1.0));
        const int INF(0x3f3f3f3f);
        const ll INFL(0x3f3f3f3f3f3f3f3fll);
        const int MOD(1e9+7);//998244353, 16341163, 999983, 131, 1e9 + 9
        const int dx[]={1,0,0,-1,-1,1,1,-1}, dy[]={0,-1,1,0,1,1,-1,-1};
    }using namespace _constant;
    namespace _solve{
        #define XOR int main()
        #define GG exit(0)
        #define rep(x,a,b) for(int x=a;x<=b;++x)
        #define per(x,a,b) for(int x=b;x>=a;--x)
        #define times(x) for(int cas=1,tms=(x);cas<=tms;cas++)
        #define CaseT int T;cin >> T;times(T)
        #define TCase int T;scanf("%d",&T);times(T)
        #define continue(_) if(_) continue;
        #define break(_) if(_) break;
    }using namespace _solve;
    namespace _calculate{
        bool odd(ll x){return x&1;}
        bool even(ll x){return (x&1)^1;}
        bool posi(ll x){return x>0;}
        bool nega(ll x){return x<0;}
        bool zero(ll x){return x==0;}
        bool prime(ll x){if(x<2) return 0;
            for(ll i=2;1ll*i*i<=x;i++) if(x%i==0) return 0;
            return 1;}
        ll droot(ll x){return 1+(x-1)%9;}
        ll upd(ll a, ll b){return a%b?a/b+1:a/b;};
        ll gcd(ll a, ll b){return __gcd(a, b);}
        ll lcm(ll a, ll b){return a/gcd(a, b)*b;}
        mt19937_64 rand(time(0));
        ll random(ll a, ll b){return a+rand()%(b-a+1);};
        ll bitn(ll x){ll c=0;while(x)c++,x>>=1;return c;}
        template<class T>T sqr(T x){return x*x;}
        ll qpow(ll a, ll n, ll mod = MOD){
            ll res(1);while(n){
            if(n&1) (res*=a)%=mod;
            (a*=a)%=mod;n>>=1;}
            return res%mod;}
        ll inv(ll a, ll mod = MOD){return qpow(a,mod-2, mod);}
        template<class T>void tomin(T& a,T b){if(b<a) a=b;}
        template<class T>void tomax(T& a,T b){if(b>a) a=b;}
    }using namespace _calculate;
    namespace _simple_algo{
        #define rg(a,x,y) (a+x), (a+y+1)
        #define vrg(a,x,y) (a.begin()+x),(a.begin()+y+1)
        #define all(x) (x).begin(),(x).end()
        #define rall(x) (x).rbegin(),(x).rend()
        #define clr(a,b) memset(a,b,sizeof(a))
        #define fil(a,b) fill(all(a),b)
        #define _sum(a) accumulate(a, 0ll)
        #define sz(a) (ll(a.size()))
        ll sol(const string& s){ll x=0;
            for(char c:s)x=x*10+c-48;return x;}
        string los(ll x){string s = "";
            if(x==0) return "0";
            while(x) s=char(x%10+48)+s,x/=10;
            return s;}
        bool pal(const string& s){int l = s.size();
            for(int i=0,j=l-1;i<j;i++,j--)
                if(s[i]!=s[j]) return 0;return 1;}
    }using namespace _simple_algo;
    namespace _io{
        #define FAST_IO ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
        #define bug cerr << "!!!" << endl;
        #define bugc(_) cerr << (#_) << " = " << (_) << endl;
        template<class T>void rd(T& x){cin>>x;}
        str srd(){str s;cin>>s;return s;}
        ll rd(){
            ll x=0,f=1;char ch=getchar();
            while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
            while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
            return x*f;}
        void rd(int& x){x=rd();}
        void rd(ll& x){x=rd();}
        template<class A,class B>void rd(A& a,B& b){rd(a), rd(b);}
        template<class A,class B>void rd(pair<A,B>& p){rd(p.fi, p.se);}
        template<class A,class B,class C>void rd(A& a,B& b,C& c){rd(a,b);rd(c);}
        template<class T>void wt(const T& x){cout << x << '\n';}
        template<class T>void wt(const T& x, char c){cout << x << c;}
        template<class T>void wt(const T& x, const str& s){cout << x << s;}
        template<class T>void wt(const T& x, int rnd){
            cout << fixed << setprecision(rnd) << x << '\n';}
        template<class T>void wt(const vector<T>& v){
            for(int i=0;i<sz(v);i++){cout << v[i];if(i<sz(v)-1) cout << ' ';};wt("");}
        template<class A,class B>void wt(const pair<A,B>& pr){
            cout << pr.fi << ' ' << pr.se << '\n';}
        #define out(_) wt(_),GG
    }using namespace _io;
}using namespace myland;

int n = rd();
str s = srd();

XOR{
    int cnt = 0;
    int f1 = 0, f2 = 0;
    for(char c:s){
        if(c == ')'){
            if(not cnt) f2++, cnt++;
            else cnt--;
        }
        else{
            cnt++;
        }
    }
    if(f2 > 1) out("No");
    if(f1 == 0 and f2 == 0 and cnt == 0) out("Yes");
    if((f1 == 1 and f2 == 1) and cnt == 0) out("Yes");
    if(f1 == 0 and f2 == 1 and cnt == 2) out("Yes");
    out("No");
}


#include <bits/stdc++.h>
namespace myland{
    using namespace std;
    namespace _abbr{
        #define fi first
        #define se second
        #define pb push_back
        #define pr make_pair
        #define lb lower_bound
        #define ub upper_bound
        #define str string
        #define _1s __builtin_popcountll
        #define nth(a,l,r,k) nth_element(a+l,a+l+k-1,a+r+1)
        typedef unsigned int ui;
        typedef long long ll;
        typedef unsigned long long ull;
        typedef double db;
        typedef long double ld;
        typedef pair<int,int> pii;
        typedef pair<ll,ll> pll;
        typedef vector<int> vi;
        typedef vector<ll> vl;
        typedef vector<pii> vpii;
        typedef vector<pll> vpll;
        typedef vector<vi> vvi;
        typedef vector<vl> vvl;
        typedef vector<vpii> vvpii;
        typedef vector<vpll> vvpll;
    }using namespace _abbr;
    namespace _constant{
        const double EPS(1e-8);
        const double PI(acos(-1.0));
        const int INF(0x3f3f3f3f);
        const ll INFL(0x3f3f3f3f3f3f3f3fll);
        const int MOD(1e9+7);//998244353, 16341163, 999983, 131, 1e9 + 9
        const int dx[]={1,0,0,-1,-1,1,1,-1}, dy[]={0,-1,1,0,1,1,-1,-1};
    }using namespace _constant;
    namespace _solve{
        #define XOR int main()
        #define GG exit(0)
        #define rep(x,a,b) for(int x=a;x<=b;++x)
        #define per(x,a,b) for(int x=b;x>=a;--x)
        #define times(x) for(int cas=1,tms=(x);cas<=tms;cas++)
        #define CaseT int T;cin >> T;times(T)
        #define TCase int T;scanf("%d",&T);times(T)
        #define continue(_) if(_) continue;
        #define break(_) if(_) break;
    }using namespace _solve;
    namespace _calculate{
        bool odd(ll x){return x&1;}
        bool even(ll x){return (x&1)^1;}
        bool posi(ll x){return x>0;}
        bool nega(ll x){return x<0;}
        bool zero(ll x){return x==0;}
        bool prime(ll x){if(x<2) return 0;
            for(ll i=2;1ll*i*i<=x;i++) if(x%i==0) return 0;
            return 1;}
        ll droot(ll x){return 1+(x-1)%9;}
        ll upd(ll a, ll b){return a%b?a/b+1:a/b;};
        ll gcd(ll a, ll b){return __gcd(a, b);}
        ll lcm(ll a, ll b){return a/gcd(a, b)*b;}
        mt19937_64 rand(time(0));
        ll random(ll a, ll b){return a+rand()%(b-a+1);};
        ll bitn(ll x){ll c=0;while(x)c++,x>>=1;return c;}
        template<class T>T sqr(T x){return x*x;}
        ll qpow(ll a, ll n, ll mod = MOD){
            ll res(1);while(n){
            if(n&1) (res*=a)%=mod;
            (a*=a)%=mod;n>>=1;}
            return res%mod;}
        ll inv(ll a, ll mod = MOD){return qpow(a,mod-2, mod);}
        template<class T>void tomin(T& a,T b){if(b<a) a=b;}
        template<class T>void tomax(T& a,T b){if(b>a) a=b;}
    }using namespace _calculate;
    namespace _simple_algo{
        #define rg(a,x,y) (a+x), (a+y+1)
        #define vrg(a,x,y) (a.begin()+x),(a.begin()+y+1)
        #define all(x) (x).begin(),(x).end()
        #define rall(x) (x).rbegin(),(x).rend()
        #define clr(a,b) memset(a,b,sizeof(a))
        #define fil(a,b) fill(all(a),b)
        #define _sum(a) accumulate(a, 0ll)
        #define sz(a) (ll(a.size()))
        ll sol(const string& s){ll x=0;
            for(char c:s)x=x*10+c-48;return x;}
        string los(ll x){string s = "";
            if(x==0) return "0";
            while(x) s=char(x%10+48)+s,x/=10;
            return s;}
        bool pal(const string& s){int l = s.size();
            for(int i=0,j=l-1;i<j;i++,j--)
                if(s[i]!=s[j]) return 0;return 1;}
    }using namespace _simple_algo;
    namespace _io{
        #define FAST_IO ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
        #define bug cerr << "!!!" << endl;
        #define bugc(_) cerr << (#_) << " = " << (_) << endl;
        template<class T>void rd(T& x){cin>>x;}
        str srd(){str s;cin>>s;return s;}
        ll rd(){
            ll x=0,f=1;char ch=getchar();
            while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
            while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
            return x*f;}
        void rd(int& x){x=rd();}
        void rd(ll& x){x=rd();}
        template<class A,class B>void rd(A& a,B& b){rd(a), rd(b);}
        template<class A,class B>void rd(pair<A,B>& p){rd(p.fi, p.se);}
        template<class A,class B,class C>void rd(A& a,B& b,C& c){rd(a,b);rd(c);}
        template<class T>void wt(const T& x){cout << x << '\n';}
        template<class T>void wt(const T& x, char c){cout << x << c;}
        template<class T>void wt(const T& x, const str& s){cout << x << s;}
        template<class T>void wt(const T& x, int rnd){
            cout << fixed << setprecision(rnd) << x << '\n';}
        template<class T>void wt(const vector<T>& v){
            for(int i=0;i<sz(v);i++){cout << v[i];if(i<sz(v)-1) cout << ' ';};wt("");}
        template<class A,class B>void wt(const pair<A,B>& pr){
            cout << pr.fi << ' ' << pr.se << '\n';}
        #define out(_) wt(_),GG
    }using namespace _io;
}using namespace myland;

int n = rd();

XOR{
    int cnt = 0, flg = 0;
    for(char c:srd())
        if(c=='(') cnt++;
        else if(cnt) cnt--;
        else flg++;
    wt((flg == 0 and cnt == 0) or (flg == 1 and cnt == 1)? "Yes" : "No");
}


#include <bits/stdc++.h>
namespace myland{
    using namespace std;
    namespace _abbr{
        #define fi first
        #define se second
        #define pb push_back
        #define pr make_pair
        #define lb lower_bound
        #define ub upper_bound
        #define str string
        #define _1s __builtin_popcountll
        #define nth(a,l,r,k) nth_element(a+l,a+l+k-1,a+r+1)
        typedef unsigned int ui;
        typedef long long ll;
        typedef unsigned long long ull;
        typedef double db;
        typedef long double ld;
        typedef pair<int,int> pii;
        typedef pair<ll,ll> pll;
        typedef vector<int> vi;
        typedef vector<ll> vl;
        typedef vector<pii> vpii;
        typedef vector<pll> vpll;
        typedef vector<vi> vvi;
        typedef vector<vl> vvl;
        typedef vector<vpii> vvpii;
        typedef vector<vpll> vvpll;
    }using namespace _abbr;
    namespace _constant{
        const double EPS(1e-8);
        const double PI(acos(-1.0));
        const int INF(0x3f3f3f3f);
        const ll INFL(0x3f3f3f3f3f3f3f3fll);
        const int MOD(1e9+7);//998244353, 16341163, 999983, 131, 1e9 + 9
        const int dx[]={1,0,0,-1,-1,1,1,-1}, dy[]={0,-1,1,0,1,1,-1,-1};
    }using namespace _constant;
    namespace _solve{
        #define XOR int main()
        #define GG exit(0)
        #define rep(x,a,b) for(int x=a;x<=b;++x)
        #define per(x,a,b) for(int x=b;x>=a;--x)
        #define times(x) for(int cas=1,tms=(x);cas<=tms;cas++)
        #define CaseT int T;cin >> T;times(T)
        #define TCase int T;scanf("%d",&T);times(T)
        #define continue(_) if(_) continue;
        #define break(_) if(_) break;
    }using namespace _solve;
    namespace _calculate{
        bool odd(ll x){return x&1;}
        bool even(ll x){return (x&1)^1;}
        bool posi(ll x){return x>0;}
        bool nega(ll x){return x<0;}
        bool zero(ll x){return x==0;}
        bool prime(ll x){if(x<2) return 0;
            for(ll i=2;1ll*i*i<=x;i++) if(x%i==0) return 0;
            return 1;}
        ll droot(ll x){return 1+(x-1)%9;}
        ll upd(ll a, ll b){return a%b?a/b+1:a/b;};
        ll gcd(ll a, ll b){return __gcd(a, b);}
        ll lcm(ll a, ll b){return a/gcd(a, b)*b;}
        mt19937_64 rand(time(0));
        ll random(ll a, ll b){return a+rand()%(b-a+1);};
        ll bitn(ll x){ll c=0;while(x)c++,x>>=1;return c;}
        template<class T>T sqr(T x){return x*x;}
        ll qpow(ll a, ll n, ll mod = MOD){
            ll res(1);while(n){
            if(n&1) (res*=a)%=mod;
            (a*=a)%=mod;n>>=1;}
            return res%mod;}
        ll inv(ll a, ll mod = MOD){return qpow(a,mod-2, mod);}
        template<class T>void tomin(T& a,T b){if(b<a) a=b;}
        template<class T>void tomax(T& a,T b){if(b>a) a=b;}
    }using namespace _calculate;
    namespace _simple_algo{
        #define rg(a,x,y) (a+x), (a+y+1)
        #define vrg(a,x,y) (a.begin()+x),(a.begin()+y+1)
        #define all(x) (x).begin(),(x).end()
        #define rall(x) (x).rbegin(),(x).rend()
        #define clr(a,b) memset(a,b,sizeof(a))
        #define fil(a,b) fill(all(a),b)
        #define _sum(a) accumulate(a, 0ll)
        #define sz(a) (ll(a.size()))
        ll sol(const string& s){ll x=0;
            for(char c:s)x=x*10+c-48;return x;}
        string los(ll x){string s = "";
            if(x==0) return "0";
            while(x) s=char(x%10+48)+s,x/=10;
            return s;}
        bool pal(const string& s){int l = s.size();
            for(int i=0,j=l-1;i<j;i++,j--)
                if(s[i]!=s[j]) return 0;return 1;}
    }using namespace _simple_algo;
    namespace _io{
        #define FAST_IO ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
        #define bug cerr << "!!!" << endl;
        #define bugc(_) cerr << (#_) << " = " << (_) << endl;
        template<class T>void rd(T& x){cin>>x;}
        str srd(){str s;cin>>s;return s;}
        ll rd(){
            ll x=0,f=1;char ch=getchar();
            while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
            while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
            return x*f;}
        void rd(int& x){x=rd();}
        void rd(ll& x){x=rd();}
        template<class A,class B>void rd(A& a,B& b){rd(a), rd(b);}
        template<class A,class B>void rd(pair<A,B>& p){rd(p.fi, p.se);}
        template<class A,class B,class C>void rd(A& a,B& b,C& c){rd(a,b);rd(c);}
        template<class T>void wt(const T& x){cout << x << '\n';}
        template<class T>void wt(const T& x, char c){cout << x << c;}
        template<class T>void wt(const T& x, const str& s){cout << x << s;}
        template<class T>void wt(const T& x, int rnd){
            cout << fixed << setprecision(rnd) << x << '\n';}
        template<class T>void wt(const vector<T>& v){
            for(int i=0;i<sz(v);i++){cout << v[i];if(i<sz(v)-1) cout << ' ';};wt("");}
        template<class A,class B>void wt(const pair<A,B>& pr){
            cout << pr.fi << ' ' << pr.se << '\n';}
        #define out(_) wt(_),GG
    }using namespace _io;
}using namespace myland;

int n = rd();

XOR{
    int cnt = 0, flg = 0;
    for(char c:srd())
        if(c=='(') cnt++;
        else if(cnt) c--;
        else flg++;
    wt((flg == 0 and cnt == 0) or (flg == 1 and cnt == 1)? "Yes" : "No");
}


#include <bits/stdc++.h>
namespace myland{
    using namespace std;
    namespace _abbr{
        #define fi first
        #define se second
        #define pb push_back
        #define pr make_pair
        #define lb lower_bound
        #define ub upper_bound
        #define str string
        #define _1s __builtin_popcountll
        #define nth(a,l,r,k) nth_element(a+l,a+l+k-1,a+r+1)
        typedef unsigned int ui;
        typedef long long ll;
        typedef unsigned long long ull;
        typedef double db;
        typedef long double ld;
        typedef pair<int,int> pii;
        typedef pair<ll,ll> pll;
        typedef vector<int> vi;
        typedef vector<ll> vl;
        typedef vector<pii> vpii;
        typedef vector<pll> vpll;
        typedef vector<vi> vvi;
        typedef vector<vl> vvl;
        typedef vector<vpii> vvpii;
        typedef vector<vpll> vvpll;
    }using namespace _abbr;
    namespace _constant{
        const double EPS(1e-8);
        const double PI(acos(-1.0));
        const int INF(0x3f3f3f3f);
        const ll INFL(0x3f3f3f3f3f3f3f3fll);
        const int MOD(1e9+7);//998244353, 16341163, 999983, 131, 1e9 + 9
        const int dx[]={1,0,0,-1,-1,1,1,-1}, dy[]={0,-1,1,0,1,1,-1,-1};
    }using namespace _constant;
    namespace _solve{
        #define XOR int main()
        #define GG exit(0)
        #define rep(x,a,b) for(int x=a;x<=b;++x)
        #define per(x,a,b) for(int x=b;x>=a;--x)
        #define times(x) for(int cas=1,tms=(x);cas<=tms;cas++)
        #define CaseT int T;cin >> T;times(T)
        #define TCase int T;scanf("%d",&T);times(T)
        #define continue(_) if(_) continue;
        #define break(_) if(_) break;
    }using namespace _solve;
    namespace _calculate{
        bool odd(ll x){return x&1;}
        bool even(ll x){return (x&1)^1;}
        bool posi(ll x){return x>0;}
        bool nega(ll x){return x<0;}
        bool zero(ll x){return x==0;}
        bool prime(ll x){if(x<2) return 0;
            for(ll i=2;1ll*i*i<=x;i++) if(x%i==0) return 0;
            return 1;}
        ll droot(ll x){return 1+(x-1)%9;}
        ll upd(ll a, ll b){return a%b?a/b+1:a/b;};
        ll gcd(ll a, ll b){return __gcd(a, b);}
        ll lcm(ll a, ll b){return a/gcd(a, b)*b;}
        mt19937_64 rand(time(0));
        ll random(ll a, ll b){return a+rand()%(b-a+1);};
        ll bitn(ll x){ll c=0;while(x)c++,x>>=1;return c;}
        template<class T>T sqr(T x){return x*x;}
        ll qpow(ll a, ll n, ll mod = MOD){
            ll res(1);while(n){
            if(n&1) (res*=a)%=mod;
            (a*=a)%=mod;n>>=1;}
            return res%mod;}
        ll inv(ll a, ll mod = MOD){return qpow(a,mod-2, mod);}
        template<class T>void tomin(T& a,T b){if(b<a) a=b;}
        template<class T>void tomax(T& a,T b){if(b>a) a=b;}
    }using namespace _calculate;
    namespace _simple_algo{
        #define rg(a,x,y) (a+x), (a+y+1)
        #define vrg(a,x,y) (a.begin()+x),(a.begin()+y+1)
        #define all(x) (x).begin(),(x).end()
        #define rall(x) (x).rbegin(),(x).rend()
        #define clr(a,b) memset(a,b,sizeof(a))
        #define fil(a,b) fill(all(a),b)
        #define _sum(a) accumulate(a, 0ll)
        #define sz(a) (ll(a.size()))
        ll sol(const string& s){ll x=0;
            for(char c:s)x=x*10+c-48;return x;}
        string los(ll x){string s = "";
            if(x==0) return "0";
            while(x) s=char(x%10+48)+s,x/=10;
            return s;}
        bool pal(const string& s){int l = s.size();
            for(int i=0,j=l-1;i<j;i++,j--)
                if(s[i]!=s[j]) return 0;return 1;}
    }using namespace _simple_algo;
    namespace _io{
        #define FAST_IO ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
        #define bug cerr << "!!!" << endl;
        #define bugc(_) cerr << (#_) << " = " << (_) << endl;
        template<class T>void rd(T& x){cin>>x;}
        str srd(){str s;cin>>s;return s;}
        ll rd(){
            ll x=0,f=1;char ch=getchar();
            while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
            while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
            return x*f;}
        void rd(int& x){x=rd();}
        void rd(ll& x){x=rd();}
        template<class A,class B>void rd(A& a,B& b){rd(a), rd(b);}
        template<class A,class B>void rd(pair<A,B>& p){rd(p.fi, p.se);}
        template<class A,class B,class C>void rd(A& a,B& b,C& c){rd(a,b);rd(c);}
        template<class T>void wt(const T& x){cout << x << '\n';}
        template<class T>void wt(const T& x, char c){cout << x << c;}
        template<class T>void wt(const T& x, const str& s){cout << x << s;}
        template<class T>void wt(const T& x, int rnd){
            cout << fixed << setprecision(rnd) << x << '\n';}
        template<class T>void wt(const vector<T>& v){
            for(int i=0;i<sz(v);i++){cout << v[i];if(i<sz(v)-1) cout << ' ';};wt("");}
        template<class A,class B>void wt(const pair<A,B>& pr){
            cout << pr.fi << ' ' << pr.se << '\n';}
        #define out(_) wt(_),GG
    }using namespace _io;
}using namespace myland;

int n = rd();
str s = srd();

XOR{
    int cnt = 0;
    int f = 0;
    for(char c:s){
        if(c == '('){
            cnt++;
            if(f == 1) cnt--, f = -1;
        }
        else{
            if(not cnt and f) out("No");
            if(not cnt) f = 1;
            else cnt--;
        }
    }
    out(cnt == 0 ? "Yes" : "No");
}


//** aman**/
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define dl          double
#define hell        1000000007
#define endl        '\n'
#define rep(i,a,b) for(int i=a;i<b;i++)
#define lb lower_bound
#define ub upper_bound
#define bs          binary_search
#define ios         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
int main(){
	int n;cin>>n;
	string s;cin>>s;
	if(n%2==1)return cout<<"No",0;
	int cnt=0;
	int p1=-1,p2=-1;cnt=0;
	for(int i=0;i<n;i++){
		if(s[i]=='(')cnt++;
		else{
			cnt--;
			if(cnt<0){
				p1=i;
				break;
			}
		}
	}
	cnt=0;
	for(int i=n-1;i>=0;i--){
		if(s[i]==')')cnt++;
		else{
			cnt--;
			if(cnt<0){
				p2=i;
				break;
			}
		}
	}
	//cout<<p1<<" "<<p2<<endl;
	if(p1==-1&&p2!=-1)return cout<<"No",0;
	if(p2==-1&&p1!=-1)return cout<<"No",0;
	if(p1!=-1)
	s.erase(p1,1);
	if(p2!=-1)
	s.insert(p2,")");
	//cout<<s<<endl;
	cnt=0;
	for(int i=0;i<n;i++){
		if(s[i]=='(')cnt++;
		else{
			cnt--;
			if(cnt<0)return cout<<"No",0;
		}
	}
	if(cnt>0)return cout<<"No",0;
	cout<<"Yes";
}


//** aman**/
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define dl          double
#define hell        1000000007
#define endl        '\n'
#define rep(i,a,b) for(int i=a;i<b;i++)
#define lb lower_bound
#define ub upper_bound
#define bs          binary_search
#define ios         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
int main(){
	int n;cin>>n;
	string s;cin>>s;
	if(n%2==1)return cout<<"No",0;
	int cnt=0;
	int p1=-1,p2=-1;cnt=0;
	for(int i=0;i<n;i++){
		if(s[i]=='(')cnt++;
		else{
			cnt--;
			if(cnt<0){
				p1=i;
				break;
			}
		}
	}
	cnt=0;
	for(int i=n-1;i>=0;i--){
		if(s[i]==')')cnt++;
		else{
			cnt--;
			if(cnt<0){
				p2=i;
				break;
			}
		}
	}
	cout<<p1<<" "<<p2<<endl;
	if(p1!=-1)
	s.erase(p1,1);
	if(p2!=-1)
	s.insert(p2,")");
	cout<<s<<endl;
	cnt=0;
	for(int i=0;i<n;i++){
		if(s[i]=='(')cnt++;
		else{
			cnt--;
			if(cnt<0)return cout<<"No",0;
		}
	}
	cout<<"Yes";
}


//** aman**/
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define dl          double
#define hell        1000000007
#define endl        '\n'
#define rep(i,a,b) for(int i=a;i<b;i++)
#define lb lower_bound
#define ub upper_bound
#define bs          binary_search
#define ios         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
int main(){
	int n;cin>>n;
	string s;cin>>s;
	if(n%2==1)return cout<<"No",0;
	int cnt=0;
	int p1=-1,p2=-1;cnt=0;
	for(int i=0;i<n;i++){
		if(s[i]=='(')cnt++;
		else{
			cnt--;
			if(cnt<0){
				p1=i;
				break;
			}
		}
	}
	cnt=0;
	for(int i=n-1;i>=0;i--){
		if(s[i]==')')cnt++;
		else{
			cnt--;
			if(cnt<0){
				p2=i;
				break;
			}
		}
	}
	//cout<<p1<<" "<<p2<<endl;
	if(p1!=-1)
	s.erase(p1,1);
	if(p2!=-1)
	s.insert(p2,")");
	//cout<<s<<endl;
	cnt=0;
	for(int i=0;i<n;i++){
		if(s[i]=='(')cnt++;
		else{
			cnt--;
			if(cnt<0)return cout<<"No",0;
		}
	}
	if(cnt>0)return cout<<"No",0;
	cout<<"Yes";
}


#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define ios	    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;

#define N  100005

int main()
{
	ios
	ll n,i,j;
	string s;
	cin>>n>>s;
	ll c=0,o=0;
	stack<char>st;
	for(i=0;i<n;i++){
		if(s[i]=='(')
			st.push(i);
		else{
			if(st.size()>0&&s[st.top()]=='(')st.pop();
			else st.push(i);
		}
	}
	if(st.size()==0){
		cout<<"Yes";return 0;
	}
	if(st.size()==2){
		ll p1=st.top();st.pop();
		ll p2=st.top();
		if(s[p1]=='('&&s[p2]==')')cout<<"Yes";else cout<<"No";
	}else cout<<"No";
	return 0;
}


#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define ios	    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
#define N  100005
int main()
{
	ios
	ll n,i,j;
	string s;
	cin>>n>>s;
	if(n%2){cout<<"No";return 0;}
	ll c=0,o=0;
	stack<char>st;
	for(i=0;i<n;i++){
		if(s[i]=='(')
			st.push(i);
		else{
			if(st.size()>0&&s[st.top()]=='(')st.pop();
			else st.push(i);
		}
	}
	if(st.size()==0){
		cout<<"Yes";return 0;
	}
	if(st.size()==2){
		ll p1=st.top();st.pop();
		ll p2=st.top();st.pop();
		if(s[p1]=='('&&s[p2]==')')cout<<"Yes";else cout<<"No";
	}else cout<<"No";
	return 0;
}


//** aman**/
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define dl          double
#define hell        1000000007
#define endl        '\n'
#define rep(i,a,b) for(int i=a;i<b;i++)
#define lb lower_bound
#define ub upper_bound
#define bs          binary_search
#define ios         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
int main(){
	int n;cin>>n;
	string s;cin>>s;
	if(n%2==1)return cout<<"No",0;
	int cnt=0;
	int p1=-1,p2=-1;cnt=0;
	for(int i=0;i<n;i++){
		if(s[i]=='(')cnt++;
		else{
			cnt--;
			if(cnt<0){
				p1=i;
				break;
			}
		}
	}
	cnt=0;
	for(int i=n-1;i>=0;i--){
		if(s[i]==')')cnt++;
		else{
			cnt--;
			if(cnt<0){
				p2=i;
				break;
			}
		}
	}
	//cout<<p1<<" "<<p2<<endl;
	if(p1!=-1)
	s.erase(p1,1);
	if(p2!=-1)
	s.insert(p2,")");
	//cout<<s<<endl;
	cnt=0;
	for(int i=0;i<n;i++){
		if(s[i]=='(')cnt++;
		else{
			cnt--;
			if(cnt<0)return cout<<"No",0;
		}
	}
	cout<<"Yes";
}


//@author :: Abhimanyu Chauhan

#pragma GCC target("avx2")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#include<bits/stdc++.h>

#define MOD			1000000007
#define oo			INT_MAX/2
#define f			first
#define s			second
#define all(v)		v.begin(),v.end()
#define pair_int 	pair<int,int>
#define pair_ll 	pair<int,long long>
#define eb			emplace_back
#define pb			push_back
#define fo(i,n)	for(int i=0;i<n;i++)
#define Fo(i,k,n)	for(int i=k;i<n;i++)
#define deb(x)			cout << #x << " " << x << endl

using namespace std;
using ll  = long long;
using lld = long double;
using vll = int64_t;

int main(){

#ifndef ONLINE_JUDGE
    // freopen("in.txt","r",stdin);
#endif

    ios_base::sync_with_stdio(0);cin.tie(0);

    int n ;
    cin >> n;
    string ss;
    cin >> ss;
    int cnt = 0;
    int pos = -1;
    fo(i , n){
        if(ss[i]=='('){
            cnt++;
        }else{
            cnt--;
        }
        if(cnt==-1 && ss[i]==')'){
            if(pos==-1)
                pos = i;
        }
        if(pos != -1 && ss[i]=='('){
            swap(ss[i] , ss[pos]);

            break;
        }
    }
    // deb(pos);
    bool ok = true;
    cnt = 0;
    fo(i , n){
        if(ss[i]=='(') cnt++;
        else cnt--;
        if(cnt<0){
            ok = false;
            break;
        }
    }
    if(cnt!=0) ok = false;
    // deb(ss);

    if(ok){
        cout << "Yes\n";
    }else{
        cout << "No\n";
    }

    return 0;

}


//@author :: Abhimanyu Chauhan

#pragma GCC target("avx2")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#include<bits/stdc++.h>

#define MOD			1000000007
#define oo			INT_MAX/2
#define f			first
#define s			second
#define all(v)		v.begin(),v.end()
#define pair_int 	pair<int,int>
#define pair_ll 	pair<int,long long>
#define eb			emplace_back
#define pb			push_back
#define fo(i,n)	for(int i=0;i<n;i++)
#define Fo(i,k,n)	for(int i=k;i<n;i++)
#define deb(x)			cout << #x << " " << x << endl

using namespace std;
using ll  = long long;
using lld = long double;
using vll = int64_t;

int main(){

#ifndef ONLINE_JUDGE
    // freopen("in.txt","r",stdin);
#endif

    ios_base::sync_with_stdio(0);cin.tie(0);

    int n ;
    cin >> n;
    string ss;
    cin >> ss;
    int cnt = 0;
    int pos = -1;
    fo(i , n){
        if(ss[i]=='('){
            cnt++;
        }else{
            cnt--;
        }
        if(cnt==-1 && ss[i]==')'){
            if(pos==-1)
                pos = i;
        }
    }
    if(pos!=-1){
        cnt = 0;
        for(int j = n-1;j>pos;j--){
            if(ss[j]=='(') cnt ++;
            else cnt--;
            if(cnt==1 && ss[j]=='('){
                swap(ss[j],ss[pos]);
                break;
            }
        }
    }
    // deb(pos);
    bool ok = true;
    cnt = 0;
    fo(i , n){
        if(ss[i]=='(') cnt++;
        else cnt--;
        if(cnt<0){
            ok = false;
            break;
        }
    }
    if(cnt!=0) ok = false;
    // deb(ss);

    if(ok){
        cout << "Yes\n";
    }else{
        cout << "No\n";
    }

    return 0;

}


//@author :: Abhimanyu Chauhan

#pragma GCC target("avx2")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#include<bits/stdc++.h>

#define MOD			1000000007
#define oo			INT_MAX/2
#define f			first
#define s			second
#define all(v)		v.begin(),v.end()
#define pair_int 	pair<int,int>
#define pair_ll 	pair<int,long long>
#define eb			emplace_back
#define pb			push_back
#define fo(i,n)	for(int i=0;i<n;i++)
#define Fo(i,k,n)	for(int i=k;i<n;i++)
#define deb(x)			cout << #x << " " << x << endl

using namespace std;
using ll  = long long;
using lld = long double;
using vll = int64_t;

int main(){

#ifndef ONLINE_JUDGE
    // freopen("in.txt","r",stdin);
#endif

    ios_base::sync_with_stdio(0);cin.tie(0);

    int n ;
    cin >> n;
    string ss;
    cin >> ss;
    int cnt = 0;
    int pos = -1;
    bool ok = true;
    fo(i , n){
        if(ss[i]=='('){
            cnt++;
        }else{
            cnt--;
        }
        if(cnt==-1){
            if(pos == -1)
                pos = i;
        }
        if(cnt<-1) ok = false;
    }
    if(pos!=-1){
        cnt = 0;
        for(int j = n-1 ; j >= 0 ; j--){
            if(ss[j]=='(') cnt ++;
            else cnt--;
            if(cnt==1){
                swap(ss[j],ss[pos]);
                break;
            }
        }
    }
    // deb(pos);
    // deb(ss);

    cnt = 0;

    fo(i , n){
        if(ss[i]=='(') cnt++;
        else cnt--;
        if(cnt < 0){
            ok = false;
            break;
        }
    }

    if(cnt!=0) ok = false;

    if(ok){
        cout << "Yes\n";
    }else{
        cout << "No\n";
    }

    return 0;

}


//@author :: Abhimanyu Chauhan

#pragma GCC target("avx2")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#include<bits/stdc++.h>

#define MOD			1000000007
#define oo			INT_MAX/2
#define f			first
#define s			second
#define all(v)		v.begin(),v.end()
#define pair_int 	pair<int,int>
#define pair_ll 	pair<int,long long>
#define eb			emplace_back
#define pb			push_back
#define fo(i,n)	for(int i=0;i<n;i++)
#define Fo(i,k,n)	for(int i=k;i<n;i++)
#define deb(x)			cout << #x << " " << x << endl

using namespace std;
using ll  = long long;
using lld = long double;
using vll = int64_t;

int main(){

#ifndef ONLINE_JUDGE
    // freopen("in.txt","r",stdin);
#endif

    ios_base::sync_with_stdio(0);cin.tie(0);

    int n ;
    cin >> n;
    string ss;
    cin >> ss;
    int cnt = 0;
    int pos = -1;
    fo(i , n){
        if(ss[i]=='('){
            cnt++;
        }else{
            cnt--;
        }
        if(cnt==-1){
            if(pos == -1)
                pos = i;
        }
    }
    if(pos!=-1){
        cnt = 0;
        for(int j = n-1 ; j >= 0 ; j--){
            if(ss[j]=='(') cnt ++;
            else cnt--;
            if(cnt==1){
                swap(ss[j],ss[pos]);
                break;
            }
        }
    }
    // deb(pos);
    bool ok = true;

    cnt = 0;

    fo(i , n){
        if(ss[i]=='(') cnt++;
        else cnt--;
        if(cnt < 0){
            ok = false;
            break;
        }
    }

    if(cnt!=0) ok = false;

    if(ok){
        cout << "Yes\n";
    }else{
        cout << "No\n";
    }

    return 0;

}


//@author :: Abhimanyu Chauhan

#pragma GCC target("avx2")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#include<bits/stdc++.h>

#define MOD			1000000007
#define oo			INT_MAX/2
#define f			first
#define s			second
#define all(v)		v.begin(),v.end()
#define pair_int 	pair<int,int>
#define pair_ll 	pair<int,long long>
#define eb			emplace_back
#define pb			push_back
#define fo(i,n)	for(int i=0;i<n;i++)
#define Fo(i,k,n)	for(int i=k;i<n;i++)
#define deb(x)			cout << #x << " " << x << endl

using namespace std;
using ll  = long long;
using lld = long double;
using vll = int64_t;

int main(){

#ifndef ONLINE_JUDGE
    // freopen("in.txt","r",stdin);
#endif

    ios_base::sync_with_stdio(0);cin.tie(0);

    int n ;
    cin >> n;
    string ss;
    cin >> ss;
    int cnt = 0;
    int pos = -1;
    fo(i , n){
        if(ss[i]=='('){
            cnt++;
        }else{
            cnt--;
        }
        if(cnt==-1 && ss[i]==')'){
            if(pos==-1)
                pos = i;
        }
        if(pos != -1 && ss[i]=='('){
            swap(ss[i] , ss[n-1]);

            break;
        }
    }
    // deb(pos);
    bool ok = true;
    cnt = 0;
    fo(i , n){
        if(ss[i]=='(') cnt++;
        else cnt--;
        if(cnt<0){
            ok = false;
            break;
        }
    }
    if(cnt!=0) ok = false;
    // deb(ss);

    if(ok){
        cout << "Yes\n";
    }else{
        cout << "No\n";
    }

    return 0;

}


//@author :: Abhimanyu Chauhan

#pragma GCC target("avx2")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#include<bits/stdc++.h>

#define MOD			1000000007
#define oo			INT_MAX/2
#define f			first
#define s			second
#define all(v)		v.begin(),v.end()
#define pair_int 	pair<int,int>
#define pair_ll 	pair<int,long long>
#define eb			emplace_back
#define pb			push_back
#define fo(i,n)	for(int i=0;i<n;i++)
#define Fo(i,k,n)	for(int i=k;i<n;i++)
#define deb(x)			cout << #x << " " << x << endl

using namespace std;
using ll  = long long;
using lld = long double;
using vll = int64_t;

int main(){

#ifndef ONLINE_JUDGE
    // freopen("in.txt","r",stdin);
#endif

    ios_base::sync_with_stdio(0);cin.tie(0);

    int n ;
    cin >> n;
    string ss;
    cin >> ss;
    int cnt = 0;
    int pos = -1;
    fo(i , n){
        if(ss[i]=='('){
            cnt++;
        }else{
            cnt--;
        }
        if(cnt==-1){
            if(pos == -1)
                pos = i;
        }
    }
    if(pos!=-1){
        cnt = 0;
        for(int j = n-1 ; j > pos ; j--){
            if(ss[j]=='(') cnt ++;
            else cnt--;
            if(cnt==1){
                swap(ss[j],ss[pos]);
                break;
            }
        }
    }
    // deb(pos);
    bool ok = true;
    cnt = 0;
    fo(i , n){
        if(ss[i]=='(') cnt++;
        else cnt--;
        if(cnt < 0){
            ok = false;
            break;
        }
    }
    if(cnt!=0) ok = false;
    // deb(ss);

    if(ok){
        cout << "Yes\n";
    }else{
        cout << "No\n";
    }

    return 0;

}


//@author :: Abhimanyu Chauhan

#pragma GCC target("avx2")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#include<bits/stdc++.h>

#define MOD			1000000007
#define oo			INT_MAX/2
#define f			first
#define s			second
#define all(v)		v.begin(),v.end()
#define pair_int 	pair<int,int>
#define pair_ll 	pair<int,long long>
#define eb			emplace_back
#define pb			push_back
#define fo(i,n)	    for(int i=0;i<n;i++)
#define Fo(i,k,n)	for(int i=k;i<n;i++)
#define deb(x)		cout << #x << " " << x << endl

using namespace std;
using ll  = long long;
using lld = long double;
using vll = int64_t;

bool fun(string ss , int n){
    int cnt = 0;

    int pos = -1;

    fo(i , n){
        if(ss[i] == '('){
            cnt++;
        }else{
            cnt--;
        }
        if(cnt == -1){
            if(pos == -1)
                pos = i;
        }
    }

    if(pos != -1){
        cnt = 0;
        for(int j = n-1 ; j >= 0 ; j--){
            if(ss[j] == '(') cnt ++;
            else cnt--;
            if(cnt == 1){
                swap(ss[j] , ss[pos]);
                break;
            }
        }
    }
    // deb(pos);

    bool ok = true;

    cnt = 0;

    fo(i , n){
        if(ss[i] == '(') cnt++;
        else cnt--;
        if(cnt < 0){
            ok = false;
            break;
        }
    }
    if(cnt!=0) ok = false;
    return ok;
}

int main(){

#ifndef ONLINE_JUDGE
    // freopen("in.txt","r",stdin);
#endif

    ios_base::sync_with_stdio(0);cin.tie(0);

    int n ;
    cin >> n;
    string ss;
    cin >> ss;
    string ss1 = "";
    fo(i , n){
        if(ss[i]=='('){
            ss1+=')';
        }else{
            ss1+='(';
        }
    }

    // deb(ss1);
    bool b1 = fun(ss , n) ;
    bool b2 = fun(ss1 , n);

    if(b1 || b2){
        cout << "Yes\n";
    }else{
        cout << "No\n";
    }

    return 0;
}


//@author :: Abhimanyu Chauhan

#pragma GCC target("avx2")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#include<bits/stdc++.h>

#define MOD			1000000007
#define oo			INT_MAX/2
#define f			first
#define s			second
#define all(v)		v.begin(),v.end()
#define pair_int 	pair<int,int>
#define pair_ll 	pair<int,long long>
#define eb			emplace_back
#define pb			push_back
#define fo(i,n)	for(int i=0;i<n;i++)
#define Fo(i,k,n)	for(int i=k;i<n;i++)
#define deb(x)			cout << #x << " " << x << endl

using namespace std;
using ll  = long long;
using lld = long double;
using vll = int64_t;

int main(){

#ifndef ONLINE_JUDGE
    // freopen("in.txt","r",stdin);
#endif

    ios_base::sync_with_stdio(0);cin.tie(0);

    int n ;
    cin >> n;
    string ss;
    cin >> ss;
    int cnt = 0;
    int pos = -1;
    fo(i , n){
        if(ss[i]=='('){
            cnt++;
        }else{
            cnt--;
        }
        if(cnt==-1 && ss[i]==')'){
            if(pos==-1)
                pos = i;
        }
    }
    if(pos!=-1)
    for(int j = n-1;j>pos;j--){
        if(ss[j]=='('){
            swap(ss[j],ss[pos]);
            break;
        }
    }
    // deb(pos);
    bool ok = true;
    cnt = 0;
    fo(i , n){
        if(ss[i]=='(') cnt++;
        else cnt--;
        if(cnt<0){
            ok = false;
            break;
        }
    }
    if(cnt!=0) ok = false;
    // deb(ss);

    if(ok){
        cout << "Yes\n";
    }else{
        cout << "No\n";
    }

    return 0;

}


//@author :: Abhimanyu Chauhan

#pragma GCC target("avx2")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#include<bits/stdc++.h>

#define MOD			1000000007
#define oo			INT_MAX/2
#define f			first
#define s			second
#define all(v)		v.begin(),v.end()
#define pair_int 	pair<int,int>
#define pair_ll 	pair<int,long long>
#define eb			emplace_back
#define pb			push_back
#define fo(i,n)	for(int i=0;i<n;i++)
#define Fo(i,k,n)	for(int i=k;i<n;i++)
#define deb(x)			cout << #x << " " << x << endl

using namespace std;
using ll  = long long;
using lld = long double;
using vll = int64_t;

int main(){

#ifndef ONLINE_JUDGE
    // freopen("in.txt","r",stdin);
#endif

    ios_base::sync_with_stdio(0);cin.tie(0);

    int n ;
    cin >> n;
    string ss;
    cin >> ss;
    int cnt = 0;
    int pos = -1;
    bool ok = true;
    fo(i , n){
        if(ss[i]=='('){
            cnt++;
        }else{
            cnt--;
        }
        if(cnt==-1){
            if(pos == -1)
                pos = i;
        }
        if(cnt<-1) ok = false;
    }
    // if(pos!=-1){
    //     cnt = 0;
    //     for(int j = n-1 ; j >= 0 ; j--){
    //         if(ss[j]=='(') cnt ++;
    //         else cnt--;
    //         if(cnt==1){
    //             swap(ss[j],ss[pos]);
    //             break;
    //         }
    //     }
    // }
    // // deb(pos);
    // // deb(ss);

    // cnt = 0;

    // fo(i , n){
    //     if(ss[i]=='(') cnt++;
    //     else cnt--;
    //     if(cnt < 0){
    //         ok = false;
    //         break;
    //     }
    // }

    if(cnt!=0) ok = false;

    if(ok){
        cout << "Yes\n";
    }else{
        cout << "No\n";
    }

    return 0;

}


//@author :: Abhimanyu Chauhan

#pragma GCC target("avx2")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#include<bits/stdc++.h>

#define MOD			1000000007
#define oo			INT_MAX/2
#define f			first
#define s			second
#define all(v)		v.begin(),v.end()
#define pair_int 	pair<int,int>
#define pair_ll 	pair<int,long long>
#define eb			emplace_back
#define pb			push_back
#define fo(i,n)	for(int i=0;i<n;i++)
#define Fo(i,k,n)	for(int i=k;i<n;i++)
#define deb(x)			cout << #x << " " << x << endl

using namespace std;
using ll  = long long;
using lld = long double;
using vll = int64_t;

int main(){

#ifndef ONLINE_JUDGE
    // freopen("in.txt","r",stdin);
#endif

    ios_base::sync_with_stdio(0);cin.tie(0);

    int n ;
    cin >> n;
    string ss;
    cin >> ss;
    int cnt = 0;
    int pos = -1;
    fo(i , n){
        if(ss[i]=='('){
            cnt++;
        }else{
            cnt--;
        }
        if(cnt==-1 && ss[i]==')'){
            if(pos==-1)
                pos = i;
        }
        if(pos != -1 && ss[i]=='('){
            swap(ss[i] , ss[pos]);

            break;
        }
    }
    // deb(pos);
    bool ok = true;
    fo(i , n){
        if(ss[i]=='(') cnt++;
        else cnt--;
        if(cnt<0){
            ok = false;
            break;
        }
    }
    if(cnt!=0) ok = false;
    // deb(ss);

    if(ok){
        cout << "Yes\n";
    }else{
        cout << "No\n";
    }

    return 0;

}


//@author :: Abhimanyu Chauhan

#pragma GCC target("avx2")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#include<bits/stdc++.h>

#define MOD			1000000007
#define oo			INT_MAX/2
#define f			first
#define s			second
#define all(v)		v.begin(),v.end()
#define pair_int 	pair<int,int>
#define pair_ll 	pair<int,long long>
#define eb			emplace_back
#define pb			push_back
#define fo(i,n)	    for(int i=0;i<n;i++)
#define Fo(i,k,n)	for(int i=k;i<n;i++)
#define deb(x)		cout << #x << " " << x << endl

using namespace std;
using ll  = long long;
using lld = long double;
using vll = int64_t;

int main(){

#ifndef ONLINE_JUDGE
    // freopen("in.txt","r",stdin);
#endif

    ios_base::sync_with_stdio(0);cin.tie(0);

    int n ;
    cin >> n;
    string ss;
    cin >> ss;
    int cnt = 0;
    int pos = -1;
    fo(i , n){
        if(ss[i]=='('){
            cnt++;
        }else{
            cnt--;
        }
        if(cnt==-1){
            if(pos == -1)
                pos = i;
        }
    }
    if(pos!=-1){
        cnt = 0;
        for(int j = n-1 ; j >= 0 ; j--){
            if(ss[j]=='(') cnt ++;
            else cnt--;
            if(cnt==1){
                swap(ss[j],ss[pos]);
                break;
            }
        }
    }
    // deb(pos);
    bool ok = true;

    cnt = 0;

    fo(i , n){
        if(ss[i]=='(') cnt++;
        else cnt--;
        if(cnt < 0){
            ok = false;
            break;
        }
    }

    if(cnt!=0) ok = false;

    if(ok){
        cout << "Yes\n";
    }else{
        cout << "No\n";
    }

    return 0;

}


/**
 *  winners never quit
**/

#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define mp make_pair
typedef long long Long;

const int N = 2e5;

int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0);cout.tie(0);
  int tc, ca = 0;
  int n;
  string s;
  cin >> n >> s;
  stack <char> S;
  bool ok = true;
  int cnt = 0;
  for (int i = 0;i < n;i++){
    if (ok){
      if (s[i]=='(')S.push(s[i]);
      else if (S.size() && S.top() == '(')S.pop();
      else S.push(s[i]);
    }
  }
  if (S.size()==2 || S.size()==0)cout << "Yes" << '\n';
  else cout << "No" << '\n';
  return 0;
}


/**
 *  winners never quit
**/

#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define mp make_pair
typedef long long Long;

const int N = 2e5;

int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0);cout.tie(0);
  int tc, ca = 0;
  int n;
  string s;
  cin >> n >> s;
  stack <char> S;
  if (n%2){
    cout << "No" << '\n';
    return 0;
  }
  bool ok = true;
  int cnt = 0;
  for (int i = 0;i < n;i++){
    if (ok){
      if (s[i]=='(')S.push(s[i]);
      else if (S.size() && S.top() == '(')S.pop();
      //else S.push(s[i]);
    }
  }
  if (S.size() <= 2)cout << "Yes" << '\n';
  else cout << "No" << '\n';
  return 0;
}


/**
 *  winners never quit
**/

#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define mp make_pair
typedef long long Long;

const int N = 2e5;

int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0);cout.tie(0);
  int tc, ca = 0;
  int n;
  string s;
  cin >> n >> s;
  stack <char> S;
  if (n%2){
    cout << "No" << '\n';
    return 0;
  }
  bool ok = true;
  int cnt = 0;
  for (int i = 0;i < n;i++){
    if (ok){
      if (s[i]=='(')S.push(s[i]);
      else if (S.size() && S.top() == '(')S.pop();
      else S.push(s[i]);
    }
  }
  if (S.size()==2 || S.size()==0)cout << "Yes" << '\n';
  else cout << "No" << '\n';
  return 0;
}


/**
 *  winners never quit
**/

#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define mp make_pair
typedef long long Long;

const int N = 2e5;

int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0);cout.tie(0);
  int tc, ca = 0;
  int n;
  string s;
  cin >> n >> s;
  stack <char> S;
//  if (n%2){
//    cout << "No" << '\n';
//    return 0;
//  }
  bool ok = true;
  int cnt = 0;
  for (int i = 0;i < n;i++){
    if (ok){
      if (s[i]=='(')S.push(s[i]);
      else if (S.size() && S.top() == '(')S.pop();
      //else S.push(s[i]);
    }
  }
  if (S.size() < 2)cout << "Yes" << '\n';
  else cout << "No" << '\n';
  return 0;
}


/**
 *  winners never quit
**/

#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define mp make_pair
typedef long long Long;

const int N = 2e5;

int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0);cout.tie(0);
  int tc, ca = 0;
  int n;
  string s;
  cin >> n >> s;
  stack <char> S;
  if (n%2){
    cout << "No" << '\n';
    return 0;
  }
  bool ok = true;
  int cnt = 0;
  for (int i = 0;i < n;i++){
    if (ok){
      if (s[i]=='(')S.push(s[i]);
      else if (S.size() && S.top() == '(')S.pop();
      //else S.push(s[i]);
    }
  }
  if (S.size() < 2)cout << "Yes" << '\n';
  else cout << "No" << '\n';
  return 0;
}


/**
 *  winners never quit
**/

#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define mp make_pair
typedef long long Long;

const int N = 2e5;

int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0);cout.tie(0);
  int tc, ca = 0;
  int n;
  string s;
  cin >> n >> s;
  stack <char> S;
  if (n%2){
    cout << "No" << '\n';
    return 0;
  }
  bool ok = true;
  int cnt = 0;
  for (int i = 0;i < n;i++){
    if (s[i]=='(')S.push(s[i]);
    else {
      if (S.size())S.pop();
      else if (cnt){
        cout << "No" << '\n';
        return 0;
      }else cnt++;
    }
  }
  if ((cnt==0 && S.empty()) || (cnt==1 && S.size()==1))cout << "Yes" << '\n';
  else cout << "No" << '\n';
  return 0;
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ll n,cn=0;
    cin>>n;
    string str;
    cin>>str;
    stack<char>st;
    for(int i=0;i<n;i++)
    {
        if(str[i]=='(')
            st.push('(');
        else
        {
            if(st.empty())
                cn++;
            else
                st.pop();
        }
    }
    if(cn==1 && st.size()==1)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ll n,cn=0;
    cin>>n;
    string str;
    cin>>str;
    stack<char>st;
    for(int i=0;i<n;i++)
    {
        if(str[i]=='(')
            st.push('(');
        else
        {
            if(st.empty())
                cn++;
            else
                st.pop();
        }
    }
    if((cn==1 && st.size()==1)|| (st.empty() && cn==0))
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ll n;
    cin>>n;
    string str;
    cin>>str;
    stack<char>st;
    bool flag=false,flag1=false;
    for(int i=0;i<n;i++)
    {
        if(str[i]=='(')
        {
            st.push('(');
            if(flag==true && flag1==false)
            {
                st.pop();
                flag1=true;
            }
        }
        else
        {
            if(st.empty() && flag==true)
            {
                cout<<"No"<<endl;
                return 0;
            }
            if(st.empty() && flag==false)
            {
                flag=true;
            }
            else
                st.pop();
        }
    }
    if(st.empty())
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ll n;
    cin>>n;
    string str;
    cin>>str;
    stack<char>st;
    bool flag=false,flag1=false;
    for(int i=0;i<n;i++)
    {
        if(str[i]=='(')
        {
            st.push('(');
            if(flag==true && flag1==false)
            {
                st.pop();
                st.pop();
                flag1=true;
            }
        }
        else
        {
            if(st.empty() && flag==true)
            {
                cout<<"No"<<endl;
                return 0;
            }
            if(st.empty() && flag==false)
            {
                st.push(')');
                flag=true;
            }
            else
                st.pop();
        }
    }
    if(st.empty())
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ll n,open=0,close=0;
    cin>>n;
    string str;
    cin>>str;
    for(int i=0;i<n;i++)
        str[i]=='('?open++:close++;
    if(n%2!=0 || open!=close)
        cout<<"No"<<endl;
    else
    {
        stack<char>st;
        bool flag=false,flag1=false;
        for(int i=0;i<n;i++)
        {
            if(str[i]=='(')
            {
                if(flag==true)
                {
                    st.pop();
                    flag1=true;
                }
                else
                    st.push('(');
            }
            else
            {
                if(!st.empty())
                    if(st.top()=='(')
                        st.pop();
                else
                {
                    if(flag1==true)
                    {
                        cout<<"No"<<endl;
                        return 0;
                    }
                    st.push(')');
                    flag=true;
                }
            }
        }
        if(st.empty())
            cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;
    }
    return 0;
}


#include <iostream>
using namespace std;

int n;
char num;
int howmany;
int start;
bool flag;

int main(){ios_base::sync_with_stdio(false); cout.tie(NULL); cin.tie(NULL);

cin >>n;

if(n%2 == 1)
	cout << "No" << '\n';

else{

cin >> num;
if(num == '(')
	howmany += 1;
else if(num == ')')
	howmany -= 1;

start = howmany;

if(start > 0){
for (int i = 1; i < n; ++i){
	cin >> num;

	if(num == '(')
		howmany += 1;
	else if(num == ')')
		howmany -= 1;

	if(howmany <= -2){
		flag = true;
		break;
	}
}
}

if(start < 0){
for (int i = 1; i < n; ++i){
	cin >> num;

	if(num == '(')
		howmany += 1;
	else if(num == ')')
		howmany -= 1;

	if(howmany <= -2){
		flag = true;
		break;
	}
}
}

if(flag)
	cout << "No" << '\n';

else if(howmany != 0)
	cout << "No" << '\n';

else
	cout << "Yes" << '\n';

}

return 0;
}


#include <iostream>
using namespace std;

int n;
char num;
int howmany;
int warn;
int start;
bool flag;

int main(){ios_base::sync_with_stdio(false); cout.tie(NULL); cin.tie(NULL);

cin >>n;

cin >> num;
if(num == '(')
	howmany += 1;
else if(num == ')')
	howmany -= 1;

start = howmany;

if(start > 0){
for (int i = 1; i < n; ++i){
	cin >> num;

	if(num == '(')
		howmany += 1;
	else if(num == ')')
		howmany -= 1;

	if(howmany<0)
		warn +=1;

	if(howmany <= -2 || warn >= 2){
		flag = true;
		break;
	}
}
}

if(start < 0){
for (int i = 1; i < n; ++i){
	cin >> num;

	if(num == '(')
		howmany += 1;
	else if(num == ')')
		howmany -= 1;

	if(howmany<0)
		warn +=1;

	if(howmany <= -2 || warn >= 2){
		flag = true;
		break;
	}
}
}

if(flag)
	cout << "No" << '\n';

else if(howmany != 0)
	cout << "No" << '\n';

else
	cout << "Yes" << '\n';

return 0;
}


#include <iostream>
using namespace std;

int n;
char num;
int howmany;
int warn;
int start;
bool flag;

int main(){ios_base::sync_with_stdio(false); cout.tie(NULL); cin.tie(NULL);

cin >>n;

if(n%2 == 1)
	cout << "No" << '\n';

else{

cin >> num;
if(num == '(')
	howmany += 1;
else if(num == ')')
	howmany -= 1;

start = howmany;

if(start > 0){
for (int i = 1; i < n; ++i){
	cin >> num;

	if(num == '(')
		howmany += 1;
	else if(num == ')')
		howmany -= 1;

	if(howmany<0)
		warn +=1;

	if(howmany <= -2 || warn >= 2){
		flag = true;
		break;
	}
}
}

if(start < 0){
for (int i = 1; i < n; ++i){
	cin >> num;

	if(num == '(')
		howmany += 1;
	else if(num == ')')
		howmany -= 1;

	if(howmany<0)
		warn +=1;

	if(howmany <= -2 || warn > 2){
		flag = true;
		break;
	}
}
}

if(flag)
	cout << "No" << '\n';

else if(howmany != 0)
	cout << "No" << '\n';

else
	cout << "Yes" << '\n';

}

return 0;
}


#include <iostream>
using namespace std;

int n;
char num;
int howmany;
int warn;
bool flag;

int main(){ios_base::sync_with_stdio(false); cout.tie(NULL); cin.tie(NULL);

cin >>n;

while(n--){
	cin >> num;

	if(num == '(')
		howmany += 1;
	else if(num == ')')
		howmany -= 1;

	if(howmany<0)
		warn +=1;

	if(howmany <= -2 || warn >= 2){
		flag = true;
		break;
	}

}

if(flag)
	cout << "No" << '\n';

else if(howmany != 0)
	cout << "No" << '\n';

else
	cout << "Yes" << '\n';

return 0;
}


#include <iostream>
using namespace std;

int n;
char num;
int howmany;
int warn;
int start;
bool flag;

int main(){ios_base::sync_with_stdio(false); cout.tie(NULL); cin.tie(NULL);

cin >>n;

if(n%2 == 1)
	cout << "No" << '\n';

else{

cin >> num;
if(num == '(')
	howmany += 1;
else if(num == ')')
	howmany -= 1;

start = howmany;

if(start > 0){
for (int i = 1; i < n; ++i){
	cin >> num;

	if(num == '(')
		howmany += 1;
	else if(num == ')')
		howmany -= 1;

	if(howmany<0)
		warn +=1;

	if(howmany <= -2 || warn >= 2){
		flag = true;
		break;
	}
}
}

if(start < 0){
for (int i = 1; i < n; ++i){
	cin >> num;

	if(num == '(')
		howmany += 1;
	else if(num == ')')
		howmany -= 1;

	if(howmany <= -2){
		flag = true;
		break;
	}
}
}

if(flag)
	cout << "No" << '\n';

else if(howmany != 0)
	cout << "No" << '\n';

else
	cout << "Yes" << '\n';

}

return 0;
}


#include <iostream>
using namespace std;

int n;
char num;
int howmany;
int warn;
int start;
bool flag;

int main(){ios_base::sync_with_stdio(false); cout.tie(NULL); cin.tie(NULL);

cin >>n;

if(n%2 == 1)
	cout << "No" << '\n';

else{

cin >> num;
if(num == '(')
	howmany += 1;
else if(num == ')')
	howmany -= 1;

start = howmany;

if(start > 0){
for (int i = 1; i < n; ++i){
	cin >> num;

	if(num == '(')
		howmany += 1;
	else if(num == ')')
		howmany -= 1;

	if(howmany<0)
		warn +=1;

	if(howmany <= -2 || warn >= 2){
		flag = true;
		break;
	}
}
}

if(start < 0){
for (int i = 1; i < n; ++i){
	cin >> num;

	if(num == '(')
		howmany += 1;
	else if(num == ')')
		howmany -= 1;

	if(howmany<0)
		warn +=1;

	if(howmany <= -2 || warn >= 2){
		flag = true;
		break;
	}
}
}

if(flag)
	cout << "No" << '\n';

else if(howmany != 0)
	cout << "No" << '\n';

else
	cout << "Yes" << '\n';

}

return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
        int n;
        cin>>n;
        char a[n];
        for(int i=0;i<n;i++)
                cin>>a[i];
        stack<char> s;
        int x=0;
        for(int i=0;i<n;i++)
        {
                if(a[i]=='(')
                        s.push(a[i]);
                else
                {
                       if(s.empty())
                       {
                               x++;
                       }
                       else
                       {
                               s.pop();
                       }
                }
        }
        if(x==0 && s.empty())
        {
                cout<<"Yes";
                return 0;
        }
        else
        {
                if(x==1 && s.size()==1)
                {
                        cout<<"Yes";
                        return 0;
                }
                else
                {
                        cout<<"No";
                        return 0;
                }
        }
        return 0;
}


#include <iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int n;
    cin>>n;
    stack<char>st;
    string s;
    cin>>s;
    long long int count=0;
    int i=0;
    while(s[i]!='\0')
    {
        char c=s[i];
        //cin>>c;
        if(st.empty())
        {
            st.push(c);
        }
        else
        {
            char ch=st.top();
            if(ch==c)
            {
                st.push(ch);
            }
            else
            {
                if(ch=='(' && c==')')
                {
                    st.pop();
                }
                else
                {
                    count++;
                    st.pop();
                }
            }
        }
        i++;
    }
    if(n%2==1)
        cout<<"No";
    else
    {
        if(st.empty() && (count==0 || count==1))
            cout<<"Yes";
        else
            cout<<"No";
    }

}


#include <iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int n;
    cin>>n;
    stack<char>st;
    string s;
    cin>>s;
    long long int count=0;
    int i=0;
    while(s[i]!='\0')
    {
        char c=s[i];
        //cin>>c;
        if(st.empty())
        {
            st.push(c);
        }
        else
        {
            char ch=st.top();
            if(ch==c)
            {
                st.push(c);
            }
            else
            {
                if(ch=='(' && c==')')
                {
                    st.pop();
                }
                else
                {
                    count++;
                    st.pop();
                    st.push(c);
                }
            }
        }
        i++;
    }
    if(n%2==1)
        cout<<"No";
    else
    {
        if(st.empty() && count==0)
                cout<<"Yes";
        else if(!st.empty() && (count==1))
            cout<<"Yes";
        else
            cout<<"No";
    }

}


#include <iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int n;
    cin>>n;
    stack<char>st;
    string s;
    cin>>s;
    long long int count=0;
    int i=0;
    while(s[i]!='\0')
    {
        char c=s[i];
        //cin>>c;
        if(st.empty())
        {
            st.push(c);
        }
        else
        {
            char ch=st.top();
            if(ch==c)
            {
                st.push(c);
            }
            else
            {
                if(ch=='(' && c==')')
                {
                    st.pop();
                }
                else
                {
                    count++;
                    st.pop();
                    st.push(c);
                }
            }
        }
        i++;
    }
    if(n%2==1)
        cout<<"No";
    else
    {
        if(st.empty() && (count==0 || count==1))
            cout<<"Yes";
        else
            cout<<"No";
    }

}


#include <iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int n;
    cin>>n;
    stack<char>st;
    string s;
    cin>>s;
    long long int count=0;
    int i=0;
    while(s[i]!='\0')
    {
        char c=s[i];
        //cin>>c;
        if(st.empty())
        {
            st.push(c);
        }
        else
        {
            char ch=st.top();
            if(ch==c)
            {
                st.push(c);
            }
            else
            {
                if(ch=='(' && c==')')
                {
                    st.pop();
                }
                else
                {
                    count++;
                    st.pop();

                }
            }
        }
        i++;
    }
    if(n%2==1)
        cout<<"No";
    else
    {
        if(st.empty() && (count==0 || count==1))
            cout<<"Yes";
        else
            cout<<"No";
    }

}