{"raw_statement":[{"iden":"statement","content":"I was heading to the old tavern «ChivalryForces», because I knew that the Princess spent a lot of time there. In the basement of the tavern the bets on a popular joust «ACM ICPC» were taken. Disgusting place, full of all sorts of scum of society. On the tournament knights formed teams of three and performed tasks, which had been prepared earlier by the members of special jury consisting of n representatives of oligarchic clans and bandit gangs. The atmosphere was extremely tense there. The judges once nearly killed each other during the preparation of tasks.\n\nThey had prepared m tasks, but every judge had his own opinion which of them should have been included to the final set and which should have been kept for the next tournament. If the final set had included the task which the judge didn't want to see in it, or if it hadn't included the task he wanted to be included, he would have got terribly upset, and of course that upset included physical abuse with the use of bladed weapons. Little known that time bandit called Dragon was one of the judges, and he managed to correct everything. He suggested to choose such set of tasks for the tournament so that the number of judges who would become upset was as minimal as possible. Also, according to the rules, the number of tasks for the tournament had to be between eight and fifteen inclusively, and it should have been taken into account. It was not a great problem to choose such set of tasks. Much more difficult thing was to persuade those who got upset because of the fairness of that decision, but Dragon had a special approach to people.\n\nThe first line contains two integers separated by a space: n and m (1 ≤ n ≤ 5000, 8 ≤ m ≤ 5000) — the number of judges and the number of tasks correspondingly.\n\nThe next n lines contains m digits each, without spaces. The i-th line on its j-th position has digit 0 if the i-th judge doesn't want to see the j-th task in the final set, or digit 1 if he, on the contrary, wants this task to be included to the final set.\n\nOutput a line of m digits. On the j-th position output 0 if the j-th task should not be included to the final set, otherwise output 1 there. The number of ones in the line should be between 8 and 15, inclusively. If there are several suitable sets of tasks, output any of them.\n\n"},{"iden":"input","content":"The first line contains two integers separated by a space: n and m (1 ≤ n ≤ 5000, 8 ≤ m ≤ 5000) — the number of judges and the number of tasks correspondingly.The next n lines contains m digits each, without spaces. The i-th line on its j-th position has digit 0 if the i-th judge doesn't want to see the j-th task in the final set, or digit 1 if he, on the contrary, wants this task to be included to the final set."},{"iden":"output","content":"Output a line of m digits. On the j-th position output 0 if the j-th task should not be included to the final set, otherwise output 1 there. The number of ones in the line should be between 8 and 15, inclusively. If there are several suitable sets of tasks, output any of them."},{"iden":"examples","content":"Input4 2011000000001111111111111000000011111111111100000000111111111110000000001111111111Output11000000001111111111Input8 201010101000111111111110101001001111111111101010100011111111111010100100111111111111111001001111111111111110010011111111111111100100111111111111111001001111111111Output10101001001111111111"}],"translated_statement":null,"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ T \\in \\mathbb{Z} $ be the number of test cases.  \nFor each test case:  \n- Let $ Q \\in \\mathbb{Z} $ be the number of questions, with $ 1 \\leq Q \\leq 100 $.  \n- Let $ M \\in \\mathbb{Z} $ be the number of marked papers, with $ 0 \\leq M \\leq 100 $.  \n- For each question $ i \\in \\{1, \\dots, Q\\} $, let $ A_{i} \\subseteq \\{A, B, C, D\\} $ be the set of possible correct answers inferred from the marked papers.  \n\nEach marked paper provides $ M $ records: for question $ i $, a student’s answer $ s_{j,i} \\in \\{A, B, C, D\\} $ and its status $ t_{j,i} \\in \\{T, F\\} $, for $ j \\in \\{1, \\dots, M\\} $.  \n\n**Constraints**  \n1. $ 1 \\leq T \\leq 100 $  \n2. $ 1 \\leq Q \\leq 100 $  \n3. $ 0 \\leq M \\leq 100 $  \n4. For each $ j \\in \\{1, \\dots, M\\} $ and $ i \\in \\{1, \\dots, Q\\} $:  \n   - $ s_{j,i} \\in \\{A, B, C, D\\} $  \n   - $ t_{j,i} \\in \\{T, F\\} $  \n\n**Objective**  \nFor each question $ i \\in \\{1, \\dots, Q\\} $, determine the correct answer $ c_i \\in \\{A, B, C, D, ?\\} $ as follows:  \n- If there exists a student answer $ s_{j,i} $ such that $ t_{j,i} = T $, then $ c_i = s_{j,i} $ (and all such $ s_{j,i} $ must be identical).  \n- If all known answers for question $ i $ are marked $ F $, and there is exactly one answer choice not chosen by any student (or all choices are chosen but no $ T $), then $ c_i = ? $.  \n- If multiple distinct answers are marked $ T $ for the same question $ i $, the input is invalid (but problem assumes consistency).  \n- Otherwise, if no $ T $ exists and multiple answer choices appear among $ F $ responses, then $ c_i = ? $.  \n\nFormally:  \nFor each question $ i $:  \n- Let $ T_i = \\{ s_{j,i} \\mid t_{j,i} = T \\} $  \n- Let $ F_i = \\{ s_{j,i} \\mid t_{j,i} = F \\} $  \n- If $ |T_i| = 1 $, then $ c_i = \\text{the unique element in } T_i $  \n- If $ T_i = \\emptyset $, then $ c_i = ? $  \n- If $ |T_i| > 1 $, then the input is inconsistent (problem assumes valid input, so this case does not occur).  \n\nOutput: $ c_1, c_2, \\dots, c_Q $, each in $ \\{A, B, C, D, ?\\} $","simple_statement":"Given multiple student answer sheets with correct/incorrect marks, determine the most likely correct answer for each question. If no unique answer can be determined, output '?'.","has_page_source":false}