bool match(char left, char right) { return (left == '(' && right == ')') (left == '[' && right == ']') (left == '{' && right == '}'); }
int main() { string line; getline(cin, line);
int left_kuohao_count = 0; int right_kuohao_count = 0;
for (int i = 0; i < line.length(); i++) { if (is_left_kuohao(line[i])) left_kuohao_count += 1; if (is_right_kuohao(line[i])) right_kuohao_count += 1; }
int main() { int m,n; string ss; cin>>m>>n; for (int u = 0; u < m; ++u) { cin>>ss; if (IsRight(ss,n)== true) cout<<"YES"<<endl; else cout<<"NO"<<endl; } }