#include <iostream>
using namespace std;

int main() {
    int size, linePos, colPos, currentEl;
    cin >> size >> linePos >> colPos;
    for (int line = 1; line <= size; ++line) {
        for (int col = 1; col <= size; ++col) {
            cin >> currentEl;
            if (linePos - colPos == line - col) {
                cout << currentEl << " ";
            }
        }
    }
    return 0;
}