#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll t,b1,b2,qm=0,n;
    string str;
    cin>>t;
    while(t--)
    {
        qm=0;
        cin>>str;
        n=str.size();
        for(int i=0;i<str.size();i++)
        {
            if(str[i]=='(')
            {
                b1=i;
            }
            else if(str[i]==')')
            {
                b2=i;
            }
            else
            {
                qm++;
            }
        }
        if(b2>b1)
        {
            if(qm%2==0)
            {
                cout<<"YES\n";
            }
            else
            {
                cout<<"NO\n";
            }
        }
        else 
        {
            if(b2==0||b1==(n-1))
            {
                cout<<"NO\n";
            }
            else
            {
                if(qm%2==0)
                {
                    cout<<"YES\n";
                }
                else
                {
                    cout<<"NO\n";
                }
            }
        }
    }
    return 0;
}