Iahub wants to enhance his multitasking abilities. In order to do this, he wants to sort *n* arrays simultaneously, each array consisting of *m* integers.

Iahub can choose a pair of distinct indices *i* and *j* (1 ≤ *i*, *j* ≤ *m*, *i* ≠ *j*). Then in each array the values at positions *i* and *j* are swapped only if the value at position *i* is strictly greater than the value at position *j*.

Iahub wants to find an array of pairs of distinct indices that, chosen in order, sort all of the *n* arrays in ascending or descending order (the particular order is given in input). The size of the array can be at most <img align="middle" class="tex-formula" src="https://espresso.codeforces.com/6f1b5d2dbdd1c5069f06964cc691c24429c6151c.png" style="max-width: 100.0%;max-height: 100.0%;"/> (at most <img align="middle" class="tex-formula" src="https://espresso.codeforces.com/6f1b5d2dbdd1c5069f06964cc691c24429c6151c.png" style="max-width: 100.0%;max-height: 100.0%;"/> pairs). Help Iahub, find any suitable array.
The first line contains three integers *n* (1 ≤  *n* ≤ 1000), *m* (1 ≤ *m* ≤  100) and *k*. Integer *k* is 0 if the arrays must be sorted in ascending order, and 1 if the arrays must be sorted in descending order. Each line *i* of the next *n* lines contains *m* integers separated by a space, representing the *i*-th array. For each element *x* of the array *i*, 1 ≤ *x* ≤ 10<sup class="upper-index">6</sup> holds.
def Sol(n, m, k):
    pairs = list()
    if k == 0:
        for i in range(m - 1):
            for k in range(m - 1, i, -1):
                pairs.append((k - 1, k))
    else:
        for i in range(m - 2, -1, -1):
            for k in range(i + 1):
                pairs.append((k + 1, k))

    return pairs


n, m, k = map(int, input().split())
A = list()
for i in range(n):
    a = list(map(int, input().strip().split()))
    A.append(a)

pairs = Sol(n, m, k)
print(len(pairs))
for a, b in pairs:
    print(f"{a + 1} {b + 1}")