namespace ConsoleApp4
{
    internal class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int kocka = 0;
            int brojac = 0;
            for (int i = 0; i < n; i++)
            {


                string[] p = (Console.ReadLine().Split(' '));

                int b = int.Parse(p[0]);
                int c = int.Parse(p[1]);
                int[] a1 = new int[b];
                int[] a2 = new int[c];
                if (b != c)
                {
                    brojac++;
                }
                else
                {
                    kocka= kocka + b;

                }
            }
            for (int i = 1; i <= kocka; i++)
            {
                int zbir = 0;

                Console.WriteLine("");
                for (int c=1; c<= kocka; c++)
                {
                    zbir= zbir + c;
                    if (kocka / zbir <= 1)
                    {
                        Console.Write("1 ");
                    }
                    else
                    {
                        Console.Write("0 ");
                    }
                        
                }
                Console.WriteLine("");
            }
            for (int j = 0; j < brojac; j++)
            {
                
                Console.WriteLine("-1");
            }

            
        }
    }
}