#include #include using namespace std; bool check(char d , char m){ if((d=='}'&&m=='{')||(d==']'&&m=='[')||(d==')'&&m=='(')) return true; return false; } int main(){ int t; cin>>t; cin.ignore(); while(t--){ stack a; string s; getline(cin,s); for(int i=0;i