Chefland is a grid with N$N$ rows and M$M$ columns. Each cell of this grid is either empty or contains a house. The distance between a pair of houses is the Manhattan distance between the cells containing them.
For each d$d$ between 1$1$ and N+M−2$N+M-2$ inclusive, Chef wants to calculate the number of unordered pairs of distinct houses with distance equal to d$d$. Please help him!

-----Input-----
- The first line of the input contains a single integer T$T$ denoting the number of test cases. The description of T$T$ test cases follows.
- The first line of each test case contains two space-separated integers N$N$ and M$M$.
- N$N$ lines follow. For each i$i$ (1≤i≤N$1 \le i \le N$), the i$i$-th of these lines contains a binary string with length M$M$; for each j$j$ (1≤j≤M$1 \le j \le M$), the j$j$-th character of this string is '1' if the cell in the i$i$-th row and j$j$-th column contains a house or '0' if it is empty.

-----Output-----
For each test case, print a single line containing N+M−2$N+M-2$ space-separated integers. For each valid i$i$, the i$i$-th integer should denote the number of pairs with distance i$i$.

-----Constraints-----
- 1≤T≤3$1 \le T \le 3$
- 2≤N,M≤300$2 \le N, M \le 300$

-----Subtasks-----
Subtask #1 (50 points): N,M≤50$N, M \le 50$
Subtask #2 (50 points): original constraints

-----Example Input-----
1
3 4
0011
0000
0100

-----Example Output-----
1 0 1 1 0

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = 'T=int(input())\n\n \ndef dist(z,i,j):\n    return abs(z[i][0]-z[j][0])+abs(z[i][1]-z[j][1])\n \nfor i in range(T):\n    l=list(map(int,input().split()))\n    n,m=l[0],l[1]\n    grd=[list(map(int,input())) for i in range(n)]\n    z=[]\n    for i,r in enumerate(grd):\n     for j,v in enumerate(r):\n       if v:\n        z.append((i,j))\n   \n     distance=[0]*(n+m-2)\n     for i in range(len(z)):\n      for j in range(i+1,len(z)):\n       d=dist(z,i,j)\n       distance[d-1]+=1\n \n  \n \n    print(*distance)\n'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 13309