#include <bits/stdc++.h>   using namespace std;   int a[1002][102];   int main() {     int n, m, k, x;     cin >> n >> m >> k;     cout << m * (m - 1) / 2 << endl;     for (int i = 0; i < m; i++) {       for (int j = i + 1; j < m; j++) {         if (!k)           cout << i + 1 <<     << j + 1 << endl;         else           cout << j + 1 <<     << i + 1 << endl;       }     }     return 0;   }   