#include<bits/stdc++.h>
#include<stack>
using namespace std;
bool pd(string t)
{
stack<char> a;
for(int i=0;i<t.size();i++)
{
if(t[i]=='(',t[i]=='[',t[i]=='{')
{
a.push(t[i]);
}
else
{
if(t[i]==')')
{
if(a.top()=='(')
{
a.pop();
}
else
{
return 0;
}
}
else
{
if(t[i]==']')
{
if(a.top()=='[')
{
a.pop();
}
else
{
return 0;
}
}
else
{
if(a[i]=='}')
{
if(a.top()=='{')
{
a.pop();
}
else
{
return 0;
}
}
}
}
}
}
}
if(a.empty())
{
return 1;
}
return 0;
}
int main ()
{
int a;
string n;
cin>>a;
for(int i=1;i<=a;i++)
{
getline(cin,n);
}
return 0;
}