import io import sys from collections import defaultdict, deque, Counter from itertools import permutations, combinations, accumulate from heapq import heappush, heappop from bisect import bisect_right, bisect_left from math import gcd import math _INPUT = """\ 6 1 1 0 1 1 1 1 2 0 1 3 4 000 011 110 111 """ def input(): return sys.stdin.readline()[:-1] def solve(test): N,M=map(int, input().split()) S=[input() for _ in range(M)] S=[sum([1<