#include<bits/stdc++.h>
using namespace std;
stack<char> s;
int n;
char couple(char p){
if(p==']'){
return '[';
}else if(p=='}'){
return '{';
}else{
return '(';
}
return '/0';
}
int main(){
cin>>n;
string p;
getline(cin,p);
while(n--){
while(!s.empty()){
s.pop();
}
getline(cin,p);
for(int i=0;i<p.size();++i){
if(s.empty()){
s.push(p[i]);
continue;
}
if(couple(p[i])==s.top()){
s.pop();
}else{
s.push(p[i]);
}
}
if(s.empty()){
printf("Yes\n");
}else{
printf("No\n");
}
}
return 0;
}
问题在于只会输出No是怎么回事