#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<map>
#include<queue>
#include<vector>
#include<set>
#include<cmath>
#include<cstdlib>
#include<ctime>
using namespace std;
#define FOR(a, b, c) for(int a = b; a <= c; a++)
#define F f[i][j][l][r]
#define FF f[i-1][j-(r-l+1)][p][q]
#define P pre[i][j][l][r]
#define pt(x, y) path(i-1, j-(r-l+1), p, q, (x), (y))
#define PR pre[p.i][p.j][p.l][p.r][p.x][p.y]
const int mx = 16;
const int inf = 1<<30;
void fre() {
freopen(".txt", "r", stdin);
freopen(".txt", "w", stdout);
}
int n, m, k;
int a[mx][mx], f[mx][226][mx][mx][2][2];
struct path{
int i, j, l, r, x, y;
path(int i = 0, int j = 0, int l = 0, int r = 0, int x = 0, int y = 0) : i(i), j(j), l(l), r(r), x(x), y(y) {}
}pre[mx][226][mx][mx][2][2];
inline int W(int i, int l, int r){
int res = 0;
FOR(j, l, r) res += a[i][j];
return res;
}
inline void print(path p) {
if(p.j == 0) return ;
print(path(PR.i, PR.j, PR.l, PR.r, PR.x, PR.y));
FOR(i, p.l, p.r) printf("%d %d\n", p.i, i);
}
int main(){
//fre();
cin >> n >> m >> k;
FOR(i, 1, n) FOR(j, 1, m) scanf("%d", &a[i][j]);
FOR(i, 1, n)
FOR(j, 1, min(i*m, k)) //注意上界
FOR(l, 1, m)
FOR(r, l, min(j+l-1, m)) {
F[0][0] += W(i, l, r);
F[0][1] += W(i, l, r);//这里可以优化一下, 用前缀和可以O(1)计算,
F[1][1] += W(i, l, r);
F[1][0] += W(i, l, r);//
int res = 0;
FOR(p, l, r)
FOR(q, l, r) {
if(FF[1][0] > res) {
res = FF[1][0];
P[1][0] = pt(1, 0);
}
}
F[1][0] += res;
res = 0;
FOR(p, l, r)
FOR(q, r, m) {
if(FF[1][0] > res) {
res = FF[1][0];
P[1][1] = pt(1, 0);
}
if(FF[1][1] > res) {
res = FF[1][1];
P[1][1] = pt(1, 1);
}
}
F[1][1] += res;
res = 0;
FOR(p, 1, l)
FOR(q, l, r) {
if(FF[0][0] > res) {
res = FF[0][0];
P[0][0] = pt(0, 0);
}
if(FF[1][0] > res) {
res = FF[1][0];
P[0][0] = pt(1, 0);
}
}
F[0][0] += res;
res = 0;
FOR(p, 1, l)
FOR(q, r, m)
FOR(x, 0, 1)
FOR(y, 0, 1) {
if(FF[x][y] > res) {
res = FF[x][y];
P[0][1] = pt(x, y);
}
}
F[0][1] += res;
}
int ans = 0;
path st;
FOR(i, 1, n)
FOR(j, 1, k) //可以把这一层循环去了
FOR(l, 1, m)
FOR(r, l, m)
FOR(x, 0, 1)
FOR(y, 0, 1) {
if(F[x][y] > ans) ans = F[x][y], st = path(i, j, l, r, x, y);
}
printf("Oil : %d\n", ans);
print(st);
return 0;
}