← Home
```go
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	in := bufio.NewReader(os.Stdin)
	var n, a, b int
	fmt.Fscan(in, &n, &a, &b)

	if n > a*b {
		fmt.Print(-1)
		return
	}

	grid := make([][]int, a)
	for i := 0; i < a; i++ {
		grid[i] = make([]int, b)
	}

	var c0, c1 [][2]int
	for i := 0; i < a; i++ {
		for j := 0; j < b; j++ {
			if (i+j)%2 == 0 {
				c0 = append(c0, [2]int{i, j})
			} else {
				c1 = append(c1, [2]int{i, j})
			}
		}
	}

	oddCount := (n + 1) / 2
	evenCount := n / 2

	var oddCells, evenCells [][2]int
	if len(c0) >= oddCount && len(c1) >= evenCount {
		oddCells = c0
		evenCells = c1
	} else {
		oddCells = c1
		evenCells = c0
	}

	odd := 1
	for i := 0; i < oddCount; i++ {
		p := oddCells[i]
		grid[p[0]][p[1]] = odd
		odd += 2
	}

	even := 2
	for i := 0; i < evenCount; i++ {
		p := evenCells[i]
		grid[p[0]][p[1]] = even
		even += 2
	}

	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()

	for i := 0; i < a; i++ {
		for j := 0; j < b; j++ {
			if j > 0 {
				fmt.Fprint(out, " ")
			}
			fmt.Fprint(out, grid[i][j])
		}
		if i+1 < a {
			fmt.Fprintln(out)
		}
	}
}
```