#include <iostream>

using namespace std;

const int row[8] = {-2, -1, +1, +2, +2, +1, -1, -2};
const int col[8] = {+1, +2, +2, +1, -1, -2, -2, -1};

void try2Move(int count, int x, int y, int** board, int n);
void printAns(int** board, int n);
bool isInBoard(int x, int y, int n);

int main() {
    int n;
    cin >> n;
    
    int** board = new int*[n]();
    for(int i=0; i<n; i++)
        board[i] = new int[n]();
    
    int x, y;
    cin >> x >> y;
    
    board[x][y] = 1;
    try2Move(2, x, y, board, n);
    
    for(int i=0; i<n; i++)
        delete[] board[i];
    delete[] board;
    
    return 0;
}

void printAns(int** board, int n) {
    for(int i=0; i<n; i++) {
        for(int j=0; j<n; j++) {
            cout << board[i][j] << " ";
        }
        cout<<"\n";
    }
}

bool isInBoard(int x, int y, int n) {
    if(x < 0 || x >= n) return false;
    if(y < 0 || y >= n) return false;
    return true;
}

//===============================================================

bool checkAns = false;

bool nextCellIsFirstCell(int x, int y, int** board, int n) {
    for (int i=0; i<8; i++) {
        int xN = x + row[i];
        int yN = y + col[i];
        if(!isInBoard(xN, yN, n)) continue;
        
        if(board[xN][yN] == 1)
            return true;
    }
    return false;
}

void try2Move(int count, int x, int y, int** board, int n) {
    if(checkAns == true) return;
    if(count > n*n) {
        if(!nextCellIsFirstCell(x, y, board, n)) return;
        printAns(board, n);
        checkAns = true;
    }
    
    for (int i=0; i<8; i++) {
        int xN = x + row[i];
        int yN = y + col[i];
        
        //checking:
        // (1) if the next cell is valid
        // (2) check if the next cell is visited
        if(!isInBoard(xN, yN, n)) continue;
        if(board[xN][yN] != 0) continue;
        
        board[xN][yN] = count;
        try2Move(count+1, xN, yN, board, n);
        board[xN][yN] = 0;
    }
}