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.
n, m, k = map(int, input().split())
trash = [list(map(int, input().split())) for i in range(n)]
ans = []
if k == 0:
    for i in range(m):
        for j in range(i+1, m):
            ans.append([i, j])
if k == 1:
    for i in range(m):
        for j in range(i+1, m):
            ans.append([j, i])
print(len(ans))
for p in ans:
    print(p[0], p[1])
    
# Mon Jul 04 2022 09:26:52 GMT+0000 (Coordinated Universal Time)
