n, m, k = map(int, input().split())
a = []
for i in range(n):
a.append(list(map(int, input().split())))
ans = []
for x in range(n):
for y in range(m):
for z in range(1, n + 1):
if y % 2 == 1:
ans.append([x, y, z, a[x][y]])
else:
ans.append([x, y, z, a[min(x, n - z)][y]])
for z in range(n + 1, n + k + 1):
if y % 2 == 1:
ans.append([x, y, z, a[x][y]])
else:
ans.append([x, y, z, z - n])
for x in range(n, n + k):
for y in range(m):
for z in range(1, n + 1):
if y % 2 == 1:
ans.append([x, y, z, x - n + 1])
else:
ans.append([x, y, z, a[n - z][y]])
ans.append([x, y, n + 1, x - n + 1])
for y in range(m):
for z in range(n + 2, n + k + 1):
ans.append([n, y, z, z - n])
for x in range(n + 1, n + k):
for z in range(n + 2, n + k + 1):
ans.append([x, 0, z, max(x - n + 1, z - n)])
print(len(ans))
for cube in ans:
print(cube[0] + 1, cube[1] + 1, cube[2] + 1, cube[3])
1635B - Avoid Local Maximums | 20A - BerOS file system |
1637A - Sorting Parts | 509A - Maximum in Table |
1647C - Madoka and Childish Pranks | 689B - Mike and Shortcuts |
379B - New Year Present | 1498A - GCD Sum |
1277C - As Simple as One and Two | 1301A - Three Strings |
460A - Vasya and Socks | 1624C - Division by Two and Permutation |
1288A - Deadline | 1617A - Forbidden Subsequence |
914A - Perfect Squares | 873D - Merge Sort |
1251A - Broken Keyboard | 463B - Caisa and Pylons |
584A - Olesya and Rodion | 799A - Carrot Cakes |
1569B - Chess Tournament | 1047B - Cover Points |
1381B - Unmerge | 1256A - Payment Without Change |
908B - New Year and Buggy Bot | 979A - Pizza Pizza Pizza |
731A - Night at the Museum | 742A - Arpa’s hard exam and Mehrdad’s naive cheat |
1492A - Three swimmers | 1360E - Polygon |