시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
10 초 256 MB 39 15 14 40.000%

## 문제

A while ago a class of students took an exam. It consisted of true-or-false questions only, but the questions were really tough! Even afterward, with the help of the book, lecture notes and each other, the students are not sure what all the correct answers were. They could ask the professor of course, but he is not the kind of guy you would dare to disturb with questions that betray your ignorance. Anyway, the students at least have an idea of how they performed.

The professor has just returned the exams, but the results are not quite as expected. Unfortunately, he did not indicate on their exams which answers were right or wrong, he has simply put the number of correct answers at the top. So what were the correct answers according to the professor then? Given how far off some of the grades are from expected, there is a suspicion among some of the students that the professor did not count the correct answers properly.

Given, for each student, the answers he/she gave and the number of correct answers, can you work out what set of correct answers matches the results?

## 입력

On the first line one positive number: the number of test cases, at most 100. After that per test case:

• one line with two space-separated integers n and m (1 ≤ n ≤ 12 and 1 ≤ m ≤ 30): the number of students and the number of questions in the exam, respectively.
• n lines, each with m digits, each digit either 0 or 1: the answers given by each student, with 0 representing “false” and 1 representing “true”. This is followed by a space and a single integer c (0 ≤ c ≤ m): the number of correct answers for that student.

## 출력

Per test case:

• one line with m digits, each one either 0 or 1: the unique set of correct answers that could account for all the results. If there is not exactly one such set, the line should read “# solutions” instead, with the number of solutions in place of ‘#’.

## 예제 입력 1

3
3 5
01101 4
10100 3
00011 3
3 5
01101 0
10100 3
00011 2
4 4
0000 2
1010 2
0101 2
1111 2


## 예제 출력 1

00101
0 solutions
4 solutions
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.3602553904056549, "perplexity": 804.6021147999435}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2019-18/segments/1555578529813.23/warc/CC-MAIN-20190420120902-20190420142902-00364.warc.gz"}