using System;
class Program
{
    static void Stampa(int n, int m)
    {
        for (int i = 0; i < n; i++)
        {
            for (int j = 0; j < m; j++)
                Console.Write("1 ");
            Console.WriteLine();
        }
    }
    static void Main()
    {
        int t = int.Parse(Console.ReadLine());
        int[] n = new int[t];
        int[] m = new int[t];
        for (int i = 0; i < t; i++)
        {
            string[] nm = Console.ReadLine().Split();
            n[i] = int.Parse(nm[0]);
            m[i] = int.Parse(nm[1]);
        }
        for (int i = 0; i < t; i++)
        {
            if (n[i] == m[i])
                Stampa(n[i], m[i]);
            else
                Console.WriteLine("-1");
        }
    }
}