import math n, x, y, z = map(int, raw_input().split()) x -= 1 y -= 1 ans = [[0 for _ in xrange(0,n)] for __ in range(0,n)] for i in xrange(0,n): for j in xrange(0,n): if (((i + 1) / 2) % 2) == 0: if(((j % 4) == 0) | ((j % 4) == 3)): ans[i][j] = i * n + j + 1 else: ans[i][j] = (n * n)-(i * n + j + 1) else: if(((j % 4) == 1) | ((j % 4) == 2)): ans[i][j] = i * n + j + 1 else: ans[i][j] = (n * n)-(i * n + j + 1) dist = z - ans[x][y] for i in xrange(0,n): for j in xrange(0,n): ans[i][j] += dist print ans