using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static int[] NList => ReadLine().Split().Select(int.Parse).ToArray(); public static void Main() { Solve(); } static void Solve() { var p = NList; var (h, w) = (p[0], p[1]); var r = NList; var c = NList; var ans = new int[h][]; for (var i = 0; i < ans.Length; ++i) { ans[i] = new int[w]; for (var j = 0; j < w; ++j) { if (i == 0 && j == 0) ans[i][j] = 2000; else if (i == 0) ans[i][j] = j + h - c[j]; else if (j == 0) ans[i][j] = i + w - r[i]; else ans[i][j] = i + j; } } WriteLine(string.Join("\n", ans.Select(ai => string.Join(" ", ai)))); } }