Valera has got a rectangle table consisting of *n* rows and *m* columns. Valera numbered the table rows starting from one, from top to bottom and the columns – starting from one, from left to right. We will represent cell that is on the intersection of row *x* and column *y* by a pair of integers (*x*, *y*).

Valera wants to place exactly *k* tubes on his rectangle table. A tube is such sequence of table cells (*x*<sub class="lower-index">1</sub>, *y*<sub class="lower-index">1</sub>), (*x*<sub class="lower-index">2</sub>, *y*<sub class="lower-index">2</sub>), ..., (*x*<sub class="lower-index">*r*</sub>, *y*<sub class="lower-index">*r*</sub>), that: 
 -  *r* ≥ 2; -  for any integer *i* (1 ≤ *i* ≤ *r* - 1) the following equation |*x*<sub class="lower-index">*i*</sub> - *x*<sub class="lower-index">*i* + 1</sub>| + |*y*<sub class="lower-index">*i*</sub> - *y*<sub class="lower-index">*i* + 1</sub>| = 1 holds; -  each table cell, which belongs to the tube, must occur exactly once in the sequence. 
Valera thinks that the tubes are arranged in a fancy manner if the following conditions are fulfilled: 
 -  no pair of tubes has common cells; -  each cell of the table belongs to some tube. 
Help Valera to arrange *k* tubes on his rectangle table in a fancy manner.
The first line contains three space-separated integers *n*, *m*, *k* (2 ≤ *n*, *m* ≤ 300; 2 ≤ 2*k* ≤ *n*·*m*) — the number of rows, the number of columns and the number of tubes, correspondingly.
from itertools import permutations
from collections import deque
import heapq
import sys

input = sys.stdin.readline
n, m, k = map(int, input().split())
mat = []
if n <= m:
    cnt = 0
    for i in range(1, n + 1):
        o = []
        for j in range(1, m + 1):
            o.append((i, j))

        mat.append(o)
        cnt += 1

else:
    cnt = 0
    for i in range(1, m + 1):
        o = []
        for j in range(1, n + 1):
            o.append((j, i))

        mat.append(o)
        cnt += 1

o = mat
g = []
flag = 0
while cnt > k:
    ee = o.pop()
    g.append(ee)
    flag = 1
    cnt -= 1

if flag:
    ee = o.pop()
    g.append(ee)

# print(len(o),cnt)
while cnt < k and flag == 0:
    e = o.pop()
    # print(e)
    # print(e)
    r1 = e.pop()
    r2 = e.pop()
    o.append(e)
    o.append([r1,r2])
    # o.append()

    cnt += 1

g = g[::-1]
for i in o:
    sys.stdout.write(str(len(i)) + " ")
    for j in i:
        sys.stdout.write(str(j[0]) + " " + str(j[1]) + " ")

    sys.stdout.write("\n")

if len(g) > 0:
    sys.stdout.write(str(len(g) * len(g[0])) + " ")

p = 0
for i in g:
    if p == 0:
        x = 0
        while x < len(i):
            j = i[x]
            sys.stdout.write(str(j[0]) + " " + str(j[1]) + " ")
            x += 1

    else:
        x = len(i) - 1
        while x > -1:
            j = i[x]
            sys.stdout.write(str(j[0]) + " " + str(j[1]) + " ")
            x -= 1

    p = p ^ 1