using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            int N, M;
            string s;
            string red = Console.ReadLine();
            string[] a = red.Split(' ');
            N = int.Parse(a[0]);
            M = int.Parse(a[1]);
            for (int i = 1; i <= N; i++)
            {
                s = Console.ReadLine();
            }
            Console.WriteLine(-1);
        }
    }
}