def get_generator(n): v = (1< e^b: e = e^b if e: basis.append(e) return basis def normalize(v,basis,length): for e,l in zip(basis,length): if v&(1<<(l-1)): v ^= e return v # coding: utf-8 # Your code here! import sys read = sys.stdin.read readline = sys.stdin.readline #n,q,*m = list(map(int,read().split())) n,m = map(int,readline().split()) MOD = (1<<32)-1 basis = get_basis(get_generator(n)) length = [i.bit_length() for i in basis] #print(get_generator(n)) #print(basis) #print(length) mat = "".join(read().split()) d = {} for T in range(m): c = "".join("0" if j=="." else "1" for j in mat[T*n*n:(T+1)*n*n]) #print(c,int(c,2),"c") key = normalize(int(c,2),basis,length) #print(key) if key in d: d[key].append(T) else: d[key] = [T] #print(d) ans = [["0"]*m for i in range(m)] for k,v in d.items(): for a in v: for b in v: if a < b: ans[a][b] = "1" #print(*("".join(i) for i in ans),sep="\n") for i in range(m-1): print("".join(ans[i][i+1:]))