import static java.lang.System.err; import static java.lang.System.out; import java.util.TreeSet; public class Main { public static void main(String[] args) { new Main(); out.flush(); err.flush(); } public Main() { try (java.util.Scanner sc = new java.util.Scanner(System.in)) { int H = sc.nextInt(), W = sc.nextInt(); int[][] grid = new int[H][W]; TreeSet use = new TreeSet<>(); for (int i = 1;i <= H * W;++ i) use.add(i); for (int y = 0;y < H;++ y) { for (int x = 0;x < W;++ x) { grid[y][x] = (y + x) % 2 == 0 ? use.pollFirst() : use.pollLast(); } } for (int y = 0;y < H;++ y) { out.print(grid[y][0]); for (int x = 1;x < W;++ x) { out.print(' '); out.print(grid[y][x]); } out.println(); } check(grid); } } private void check(int[][] grid) { int H = grid.length, W = grid[0].length; int S = grid[0][0] + grid[0][1] + grid[1][0] + grid[1][1]; for (int y = 1; y < H; ++y) { for (int x = 1; x < W; ++x) { if (grid[y - 1][x - 1] + grid[y][x - 1] + grid[y - 1][x] + grid[y][x] != S) throw new AssertionError(); } } } }