#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m, k;     cin >> n >> m >> k;     vector<vector<int>> v;     vector<int> cur;     if ((n * m) % k == 0) {       int div = (n * m) / k;       for (int i = 0; i < n; i++) {         if (!(i & 1)) {           for (int j = 0; j < m; j++) {             cur.push_back(i + 1);             cur.push_back(j + 1);             if (cur.size() >= div * 2) {               vector<int> add = cur;               v.push_back(add);               cur.clear();             }           }         } else {           for (int j = m - 1; j >= 0; j--) {             if (cur.size() <= div * 2) {               cur.push_back(i + 1);               cur.push_back(j + 1);             }             if (cur.size() >= div * 2) {               vector<int> add = cur;               v.push_back(add);               cur.clear();             }           }         }       }     } else {       int div = ((n * m) - 2) / (k - 1);       int count = 0;       int flag = 0;       for (int i = 0; i < n; i++) {         if (!(i & 1)) {           for (int j = 0; j < m; j++) {             if (count == k - 1 && flag == 0) {               div = (n * m - (k - 1) * (div));               flag = 1;             }             cur.push_back(i + 1);             cur.push_back(j + 1);             if (cur.size() >= div * 2) {               vector<int> add = cur;               v.push_back(add);               cur.clear();               count++;             }           }         } else {           for (int j = m - 1; j >= 0; j--) {             if (count == k - 1 && flag == 0) {               div = (n * m - (k - 1) * (div));               flag = 1;             }             if (cur.size() <= div * 2) {               cur.push_back(i + 1);               cur.push_back(j + 1);             }             if (cur.size() >= div * 2) {               vector<int> add = cur;               v.push_back(add);               cur.clear();               count++;             }           }         }       }     }     for (int i = 0; i < v.size(); i++) {       int s = v[i].size();       s /= 2;       cout << s <<    ;       for (int j = 0; j < v[i].size(); j++) {         cout << v[i][j] <<    ;       }       cout << endl;     }     return 0;   }   