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

namespace ConsoleApp13
{
    class Program
    {
        static void Main(string[] args)
        {
            string ucitaj = Console.ReadLine();
            string[] pom = ucitaj.Split(' ');
            int h = Convert.ToInt32(pom[0]);
            int n = Convert.ToInt32(pom[1]);
            char[,] hn = new char[h, n];
            for (int i = 0; i < h; i++)
            {
                string ucitaj_red = Console.ReadLine();
                string[] pomocni = ucitaj_red.Split(' ');
                for (int j = 0; j < n; j++)
                {
                    hn[i, j] = Convert.ToChar(pomocni[j]);
                }
            }
            Console.WriteLine("-1");
        }
    }
}