T = int(input()) ANS = list('01'*10000) for _ in range(T): H,W = map(int, input().split()) for i in range(H): print(*ANS[i:i+W])