#include<iostream>
#include<map>
#include<vector>
using namespace std;
map<pair<int,int>,pair<int,int> > adj;
vector<pair<int,int> > seq[20005];
int n,m,k,first,last,avg,sq;
int main()
{   cin>>n>>m>>k;
    if(k>n*m)   k=n*m;
    for(int i=1;i<=n;i++)
    {   for(int j=1;j<=m;j++)
        {   if((i%2==0&&j==1)||(i%2==1&&j==m))
                adj[make_pair(i,j)]=(make_pair(i+1,j));
            else if(i%2==1&&j<=m-1)
            {
                adj[make_pair(i,j)]=(make_pair(i,j+1));
            }
            else if(i%2==0&&j>=2)
            {
                adj[make_pair(i,j)]=(make_pair(i,j-1));
            }
        }
    }
    //dfs(make_pair(1,1),1,1);
    int counter=1,counter1=1;
    pair<int,int> node=make_pair(1,1);
    while(counter1<=n*m)
    {   if(counter>n*m/k){  sq++;   counter=0;  }
        if(counter<=n*m/k)  seq[sq].push_back(node);
        node=adj[node];
        counter++;  counter1++;
    }
    for(int i=0;i<sq+1;i++)
    {   cout<<seq[i].size()<<" ";
        for(int j=0;j<seq[i].size();j++)
            cout<<seq[i][j].first<<" "<<seq[i][j].second<<" ";
        cout<<"\n";
    }
    return 0;
}


#include<iostream>
#include<map>
#include<vector>
using namespace std;
map<pair<int,int>,pair<int,int> > adj;
vector<pair<int,int> > seq[200005];
int main()
{   int n,m,k;
    cin>>n>>m>>k;
    if(k>n*m)   k=n*m;
    for(int i=1;i<=n;i++)
    {   for(int j=1;j<=m;j++)
        {   if((i%2==0&&j==1)||(i%2==1&&j==m))
                adj[make_pair(i,j)]=(make_pair(i+1,j));
            else if(i%2==1&&j<=m-1)
            {
                adj[make_pair(i,j)]=(make_pair(i,j+1));
            }
            else if(i%2==0&&j>=2)
            {
                adj[make_pair(i,j)]=(make_pair(i,j-1));
            }
        }
    }
    int counter=1,counter1=1,sq=0,total=n*m;
    pair<int,int> node=make_pair(1,1);
    while(counter1<=total)
    {   if(counter>total/k&&total-counter1+1>=total/k){  sq=sq+1;   counter=1;  }
        seq[sq].push_back(node);
        node=adj[node];
        counter++;  counter1++;
    }
    int small=999,index=0;
    for(int i=0;i<sq+1;i++)
    {   cout<<seq[i].size()<<" ";
        for(int j=0;j<seq[i].size();j++)
            cout<<seq[i][j].first<<" "<<seq[i][j].second<<" ";
        cout<<"\n";
    }
    return 0;
}


/*
* @Author: _dp95
* @Date:   2019-06-22 13:37:06
*/
#include "bits/stdc++.h"
using namespace std ;

#define timesaver ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll ;
typedef long double ldb ;

#define mp make_pair
#define pb push_back
#define F first
#define S second
#define nl '\n'

#define all( x ) x.begin(),x.end()
#define sz( x ) ( int )( x ).size( )
#define mem( a, val ) memset(a, val, sizeof( a ) )
#define deci( x ) cout<<fixed<<setprecision( x );
#define bitcount( x ) __builtin_popcountll( x )

const int dx[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
const int dy[8] = {-1, 0, 1, 1, 1, 0, -1, -1};

const int MAX = 100 + 10 ;
const ll INF = 1e18 ;
const int MOD = 1e9 + 7 ;

int ar[ MAX ][ MAX ], n, m, k, has[ MAX ], vis[ MAX ][ MAX ] ;
vector< pair< int, int > > v[ MAX ] ;

void dfs( int i, int j, int dx, int dy, int num, int k ){
    if( i < 0 or j < 0 or i >= n or j >= m or vis[ i ][ j ] )
        return  ;
    if( has[ num ] == 2 and k > 1 )
        num++, k-- ;
    ar[ i ][ j ] = num ;
    v[ num ].pb( mp( i + 1, j + 1 ) ) ;
    has[ num ]++ ;
    vis[ i ][ j ] = 1 ;
    if( j == m - 1 and vis[ i ][ j - 1 ] ){
        dfs( i + 1, j, 1, 0, num, k ) ;
    }
    else if( j == m - 1 ){
        dfs( i , j - 1, 0, -1, num, k ) ;
    }
    else if( j == 0 and vis[ i ][ j + 1 ] ){
        dfs( i + 1, j, 1, 0, num, k ) ;
    }
    else if( j == 0 ){
        dfs( i, j + 1, 0, 1, num, k ) ;
    }
    else{
        dfs( i + dx, j + dy, dx, dy, num, k ) ;
    }
}

int main( ){
  timesaver ;
  cin >> n >> m >> k ;
  dfs( 0, 0, 0, 1, 1, k ) ;
  /*
  for( int i = 0 ; i < n ; i++ ){
    for( int j = 0 ; j < m ; j++ ){
        cout << ar[ i ][ j ] << " " ;
    }
    cout << nl ;
  }
  //*/
  for( int i = 1 ; i <= k ; i++ ){
    cout << sz( v[ i ] ) << " " ;
    for( auto j : v[ i ] ){
        cout << j.F << " " << j.S << " " ;
    }
    cout << nl ;
  }
}


/*
* @Author: _dp95
* @Date:   2019-06-22 13:41:46
*/
#include "bits/stdc++.h"
using namespace std ;

#define timesaver ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll ;
typedef long double ldb ;

#define mp make_pair
#define pb push_back
#define F first
#define S second
#define nl '\n'

#define all( x ) x.begin(),x.end()
#define sz( x ) ( int )( x ).size( )
#define mem( a, val ) memset(a, val, sizeof( a ) )
#define deci( x ) cout<<fixed<<setprecision( x );
#define bitcount( x ) __builtin_popcountll( x )

const int dx[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
const int dy[8] = {-1, 0, 1, 1, 1, 0, -1, -1};

const int MAX = 400 + 10 ;
const ll INF = 1e18 ;
const int MOD = 1e9 + 7 ;

int ar[ MAX ][ MAX ], n, m, k,  vis[ MAX ][ MAX ] ;
vector< pair< int, int > > v[ MAX ] ;
map< int, int > has ;
void dfs( int i, int j, int dx, int dy, int num, int k ){
    if( i < 0 or j < 0 or i >= n or j >= m or vis[ i ][ j ] )
        return  ;
    if( has[ num ] == 2 and k > 1 )
        num++, k-- ;
    ar[ i ][ j ] = num ;
    v[ num ].pb( mp( i + 1, j + 1 ) ) ;
    has[ num ]++ ;
    vis[ i ][ j ] = 1 ;
    if( j == m - 1 and vis[ i ][ j - 1 ] ){
        dfs( i + 1, j, 1, 0, num, k ) ;
    }
    else if( j == m - 1 ){
        dfs( i , j - 1, 0, -1, num, k ) ;
    }
    else if( j == 0 and vis[ i ][ j + 1 ] ){
        dfs( i + 1, j, 1, 0, num, k ) ;
    }
    else if( j == 0 ){
        dfs( i, j + 1, 0, 1, num, k ) ;
    }
    else{
        dfs( i + dx, j + dy, dx, dy, num, k ) ;
    }
}

int main( ){
  timesaver ;
  cin >> n >> m >> k ;
  dfs( 0, 0, 0, 1, 1, k ) ;
  /*
  for( int i = 0 ; i < n ; i++ ){
    for( int j = 0 ; j < m ; j++ ){
        cout << ar[ i ][ j ] << " " ;
    }
    cout << nl ;
  }
  //*/
  for( int i = 1 ; i <= k ; i++ ){
    cout << sz( v[ i ] ) << " " ;
    for( auto j : v[ i ] ){
        cout << j.F << " " << j.S << " " ;
    }
    cout << nl ;
  }
}


/*
* @Author: _dp95
* @Date:   2019-06-22 15:39:12
*/
#include "bits/stdc++.h"
using namespace std ;

#define timesaver ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll ;
typedef long double ldb ;

#define mp make_pair
#define pb push_back
#define F first
#define S second
#define nl '\n'

#define all( x ) x.begin(),x.end()
#define sz( x ) ( int )( x ).size( )
#define mem( a, val ) memset(a, val, sizeof( a ) )
#define deci( x ) cout<<fixed<<setprecision( x );
#define bitcount( x ) __builtin_popcountll( x )

const int dx[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
const int dy[8] = {-1, 0, 1, 1, 1, 0, -1, -1};

const int MAX = 400 + 10 ;
const ll INF = 1e18 ;
const int MOD = 1e9 + 7 ;

int ar[ MAX ][ MAX ], n, m, k,  vis[ MAX ][ MAX ] ;
vector< pair< int, int > > v[ MAX * MAX ] ;
map< int, int > has ;

void dfs( int i, int j, int dx, int dy, int num, int k ){
    if( i < 0 or j < 0 or i >= n or j >= m )
        return  ;
    if( has[ num ] == 2 and k > 1 )
        num++, k-- ;
    ar[ i ][ j ] = num ;
    v[ num ].pb( mp( i + 1, j + 1 ) ) ;
    has[ num ]++ ;
    vis[ i ][ j ] = 1 ;
    if( j == m - 1 and vis[ i ][ j - 1 ] ){
        dfs( i + 1, j, 1, 0, num, k ) ;
    }
    else if( j == m - 1 ){
        dfs( i , j - 1, 0, -1, num, k ) ;
    }
    else if( j == 0 and vis[ i ][ j + 1 ] ){
        dfs( i + 1, j, 1, 0, num, k ) ;
    }
    else if( j == 0 ){
        dfs( i, j + 1, 0, 1, num, k ) ;
    }
    else{
        dfs( i + dx, j + dy, dx, dy, num, k ) ;
    }
}

int main( ){
  timesaver ;
  cin >> n >> m >> k ;
  dfs( 0, 0, 0, 1, 1, k ) ;
  /*
  for( int i = 0 ; i < n ; i++ ){
    for( int j = 0 ; j < m ; j++ ){
        cout << ar[ i ][ j ] << " " ;
    }
    cout << nl ;
  }
  //*/
  for( int i = 1 ; i <= k ; i++ ){
    cout << sz( v[ i ] ) << " " ;
    for( auto j : v[ i ] ){
        cout << j.F << " " << j.S << " " ;
    }
    cout << nl ;
  }
}


/*
* @Author: _dp95
* @Date:   2019-06-22 13:30:47
*/
#include "bits/stdc++.h"
using namespace std ;

#define timesaver ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll ;
typedef long double ldb ;

#define mp make_pair
#define pb push_back
#define F first
#define S second
#define nl '\n'

#define all( x ) x.begin(),x.end()
#define sz( x ) ( int )( x ).size( )
#define mem( a, val ) memset(a, val, sizeof( a ) )
#define deci( x ) cout<<fixed<<setprecision( x );
#define bitcount( x ) __builtin_popcountll( x )

const int dx[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
const int dy[8] = {-1, 0, 1, 1, 1, 0, -1, -1};

const int MAX = 100 + 10 ;
const ll INF = 1e18 ;
const int MOD = 1e9 + 7 ;

int ar[ MAX ][ MAX ], n, m, k, has[ MAX ], vis[ MAX ][ MAX ] ;
vector< pair< int, int > > v[ MAX ] ;

void dfs( int i, int j, int dx, int dy, int num, int k ){
    if( i < 0 or j < 0 or i > n or j > m )
        return  ;
    if( has[ num ] == 2 and k > 1 )
        num++, k-- ;
    ar[ i ][ j ] = num ;
    has[ num ]++ ;
    vis[ i ][ j ] = 1 ;
    if( j == m - 1 and vis[ i ][ j - 1 ] ){
        dfs( i + 1, j, 1, 0, num, k ) ;
    }
    else if( j == m - 1 ){
        dfs( i , j - 1, 0, -1, num, k ) ;
    }
    else if( j == 0 and vis[ i ][ j + 1 ] ){
        dfs( i + 1, j, 1, 0, num, k ) ;
    }
    else if( j == 0 ){
        dfs( i, j + 1, 0, 1, num, k ) ;
    }
    else{
        dfs( i + dx, j + dy, dx, dy, num, k ) ;
    }
}

int main( ){
  timesaver ;
  cin >> n >> m >> k ;
  dfs( 0, 0, 0, 1, 1, k ) ;
  for( int i = 0 ; i < n ; i++ ){
    for( int j = 0 ; j < m ; j++ ){
        v[ ar[ i ][ j ] ].pb( mp( i + 1 , j + 1 ) ) ;
    }
  }
  for( int i = 1 ; i <= k ; i++ ){
    cout << sz( v[ i ] ) << " " ;
    for( auto j : v[ i ] ){
        cout << j.F << " " << j.S << " " ;
    }
    cout << nl ;
  }
}


/*
* @Author: _dp95
* @Date:   2019-06-22 15:37:00
*/
#include "bits/stdc++.h"
using namespace std ;

#define timesaver ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll ;
typedef long double ldb ;

#define mp make_pair
#define pb push_back
#define F first
#define S second
#define nl '\n'

#define all( x ) x.begin(),x.end()
#define sz( x ) ( int )( x ).size( )
#define mem( a, val ) memset(a, val, sizeof( a ) )
#define deci( x ) cout<<fixed<<setprecision( x );
#define bitcount( x ) __builtin_popcountll( x )

const int dx[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
const int dy[8] = {-1, 0, 1, 1, 1, 0, -1, -1};

const int MAX = 400 + 10 ;
const ll INF = 1e18 ;
const int MOD = 1e9 + 7 ;

int ar[ MAX ][ MAX ], n, m, k,  vis[ MAX ][ MAX ] ;
vector< pair< int, int > > v[ MAX ] ;
map< int, int > has ;

void dfs( int i, int j, int dx, int dy, int num, int k ){
    if( i < 0 or j < 0 or i >= n or j >= m )
        return  ;
    if( has[ num ] == 2 and k > 1 )
        num++, k-- ;
    ar[ i ][ j ] = num ;
    v[ num ].pb( mp( i + 1, j + 1 ) ) ;
    has[ num ]++ ;
    vis[ i ][ j ] = 1 ;
    if( j == m - 1 and vis[ i ][ j - 1 ] ){
        dfs( i + 1, j, 1, 0, num, k ) ;
    }
    else if( j == m - 1 ){
        dfs( i , j - 1, 0, -1, num, k ) ;
    }
    else if( j == 0 and vis[ i ][ j + 1 ] ){
        dfs( i + 1, j, 1, 0, num, k ) ;
    }
    else if( j == 0 ){
        dfs( i, j + 1, 0, 1, num, k ) ;
    }
    else{
        dfs( i + dx, j + dy, dx, dy, num, k ) ;
    }
}

int main( ){
  timesaver ;
  cin >> n >> m >> k ;
  dfs( 0, 0, 0, 1, 1, k ) ;
  /*
  for( int i = 0 ; i < n ; i++ ){
    for( int j = 0 ; j < m ; j++ ){
        cout << ar[ i ][ j ] << " " ;
    }
    cout << nl ;
  }
  //*/
  for( int i = 1 ; i <= k ; i++ ){
    cout << sz( v[ i ] ) << " " ;
    for( auto j : v[ i ] ){
        cout << j.F << " " << j.S << " " ;
    }
    cout << nl ;
  }
}


/*
* @Author: _dp95
* @Date:   2019-06-22 13:38:12
*/
#include "bits/stdc++.h"
using namespace std ;

#define timesaver ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll ;
typedef long double ldb ;

#define mp make_pair
#define pb push_back
#define F first
#define S second
#define nl '\n'

#define all( x ) x.begin(),x.end()
#define sz( x ) ( int )( x ).size( )
#define mem( a, val ) memset(a, val, sizeof( a ) )
#define deci( x ) cout<<fixed<<setprecision( x );
#define bitcount( x ) __builtin_popcountll( x )

const int dx[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
const int dy[8] = {-1, 0, 1, 1, 1, 0, -1, -1};

const int MAX = 400 + 10 ;
const ll INF = 1e18 ;
const int MOD = 1e9 + 7 ;

int ar[ MAX ][ MAX ], n, m, k, has[ MAX ], vis[ MAX ][ MAX ] ;
vector< pair< int, int > > v[ MAX ] ;

void dfs( int i, int j, int dx, int dy, int num, int k ){
    if( i < 0 or j < 0 or i >= n or j >= m or vis[ i ][ j ] )
        return  ;
    if( has[ num ] == 2 and k > 1 )
        num++, k-- ;
    ar[ i ][ j ] = num ;
    v[ num ].pb( mp( i + 1, j + 1 ) ) ;
    has[ num ]++ ;
    vis[ i ][ j ] = 1 ;
    if( j == m - 1 and vis[ i ][ j - 1 ] ){
        dfs( i + 1, j, 1, 0, num, k ) ;
    }
    else if( j == m - 1 ){
        dfs( i , j - 1, 0, -1, num, k ) ;
    }
    else if( j == 0 and vis[ i ][ j + 1 ] ){
        dfs( i + 1, j, 1, 0, num, k ) ;
    }
    else if( j == 0 ){
        dfs( i, j + 1, 0, 1, num, k ) ;
    }
    else{
        dfs( i + dx, j + dy, dx, dy, num, k ) ;
    }
}

int main( ){
  timesaver ;
  cin >> n >> m >> k ;
  dfs( 0, 0, 0, 1, 1, k ) ;
  /*
  for( int i = 0 ; i < n ; i++ ){
    for( int j = 0 ; j < m ; j++ ){
        cout << ar[ i ][ j ] << " " ;
    }
    cout << nl ;
  }
  //*/
  for( int i = 1 ; i <= k ; i++ ){
    cout << sz( v[ i ] ) << " " ;
    for( auto j : v[ i ] ){
        cout << j.F << " " << j.S << " " ;
    }
    cout << nl ;
  }
}


//
//  main.cpp
//  Tubes
//
//  Created by Tony Vazquez on 3/4/19.
//  Copyright © 2019 Tony Vazquez. All rights reserved.
//

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

int main() {
    //En el peor caso hay 1 tubo chico y lod demás grandes por si no caben del mismo tamaño

    int n,m,k; //n es filas, m es columnas y k es numero de tubos
    cin >>n>>m>>k;
    int pos_vert=1;
    int pos_hor=1; //posicion horizontal y vertical
    int cubosTotal=n*m; //Total de cuadraditos
    int tamTuboGrande=cubosTotal/k;
    int cubosUsados = 0;

    for (int i = 0; i < k - 1; i++) { //Para todos los tubos grandes
        cout <<tamTuboGrande; //Imprime tamaño

        for (int j = 0; j < tamTuboGrande; j++) { //Para cada tubo imprime su cuadrado y se recorre
            cout<<" "<<pos_vert<<" "<<pos_hor; //imprime la posicion actual
             if (pos_vert%2!=1){ //Si es una fila par va para la izquierda
                 pos_hor--;
                 if(pos_hor<1){ //Si se sale de la columna entonces baja el tubo y cambia hacia la derecha
                     pos_vert++;
                     pos_hor = 1;
                     cout << "\n";
                 }
             }else if (pos_vert%2==1){ //Si es numero de fila impar va para la derecho
                pos_hor++;
                if (pos_hor>m){ //Si se sale de la columna entonces baja el tubo y reinicia el contador horizontal
                    pos_vert++;
                    pos_hor=m;
                    cout << "\n";
                }
            }
            cubosUsados++;
        }
    }
    int tamCuboChico=cubosTotal-cubosUsados;//Hace un tubo chico del tamaño los cubos que sobraron
    cout <<tamCuboChico;
    for (int i=cubosUsados; i<cubosTotal; i++) {
        cout<<" "<<pos_vert<<" "<<pos_hor;
        if (pos_vert%2!=0){ //Si es una fila par va para la izquierda
            pos_hor--;
            if(pos_hor<1){ //Si se sale de la columna entonces baja el tubo y cambia hacia la derecha
                pos_vert++;
                pos_hor = 1;
                //cout << "\n";
            }
        }else if (pos_vert%2==1){ //Si es numero de fila impar va para la derecha
            pos_hor++;
            if (pos_hor>m){ //Si se sale de la columna entonces baja el tubo y cambia hacia la izquierda
                pos_vert++;
                pos_hor=m;
                 //cout << "\n";
            }
        }
    }
     cout << "\n";
    return 0;
}


//
//  main.cpp
//  Tubes
//
//  Created by Tony Vazquez on 3/4/19.
//  Copyright © 2019 Tony Vazquez. All rights reserved.
//

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

int main() {
    //En el peor caso hay 1 tubo chico y lod demás grandes por si no caben del mismo tamaño

    int n,m,k; //n es filas, m es columnas y k es numero de tubos
    cin >>n>>m>>k;
    int pos_vert=1;
    int pos_hor=1; //posicion horizontal y vertical
    int cubosTotal=n*m; //Total de cuadraditos
    int tamTuboGrande=cubosTotal/k;
    int cubosUsados = 0;

    for (int i = 0; i < k - 1; i++) { //Para todos los tubos grandes
        cout <<tamTuboGrande; //Imprime tamaño

        for (int j = 0; j < tamTuboGrande; j++) { //Para cada tubo imprime su cuadrado y se recorre
            cout<<" "<<pos_vert<<" "<<pos_hor; //imprime la posicion actual
            /*
            if (pos_vert%2!=1){ //Si es una fila par va para la izquierda
                 pos_hor--;
                 if(pos_hor<1){ //Si se sale de la columna entonces baja el tubo y cambia hacia la derecha
                     pos_vert++;
                     pos_hor = 1;
                     cout << "\n";
                 }
             }else if (pos_vert%2==1){ //Si es numero de fila impar va para la derecho
               */ pos_hor++;
                if (pos_hor>m){ //Si se sale de la columna entonces baja el tubo y reinicia el contador horizontal
                    pos_vert++;
                    pos_hor=1;
                    cout << "\n";
                }
            //}
            cubosUsados++;
        }
    }
    int tamCuboChico=cubosTotal-cubosUsados;//Hace un tubo chico del tamaño los cubos que sobraron
    cout <<tamCuboChico;
    for (int i=cubosUsados; i<cubosTotal; i++) {
        cout<<" "<<pos_vert<<" "<<pos_hor;
        /*if (pos_vert%2!=0){ //Si es una fila par va para la izquierda
            pos_hor--;
            if(pos_hor<1){ //Si se sale de la columna entonces baja el tubo y cambia hacia la derecha
                pos_vert++;
                pos_hor = 1;
                //cout << "\n";
            }
        }else if (pos_vert%2==1){*/ //Si es numero de fila impar va para la derecha
            pos_hor++;
            if (pos_hor>m){ //Si se sale de la columna entonces baja el tubo y cambia hacia la izquierda
                pos_vert++;
                pos_hor=m;
                 //cout << "\n";
            }
        //}
    }
     cout << "\n";
    return 0;
}


//
//  main.cpp
//  Tubes
//
//  Created by Tony Vazquez on 3/4/19.
//  Copyright © 2019 Tony Vazquez. All rights reserved.
//

#include <iostream>
using namespace std;

int main(int argc, const char * argv[]) {
    //En el peor caso hay 1 tubo chico y lod demás grandes por si no caben del mismo tamaño

    int n,m,k; //n es filas, m es columnas y k es numero de tubos
    cin >>n>>m>>k;
    int pos_vert=1;
    int pos_hor=1; //posicion horizontal y vertical
    int cubosTotal=n*m; //Total de cuadraditos
    int tamTuboGrande=cubosTotal/k;
    int cubosUsados = 0;

    for (int i = 0; i < k - 1; i++) { //Para todos los tubos grandes
        cout <<tamTuboGrande; //Imprime tamaño

        for (int j = 0; j < tamTuboGrande; j++) { //Para cada tubo imprime su cuadrado y se recorre
            cout<<" "<<pos_vert<<" "<<pos_hor; //imprime la posicion actual
             if (pos_vert%2==0){ //Si es una fila par va para la izquierda
                 pos_hor--;
                 if(pos_hor<1){ //Si se sale de la columna entonces baja el tubo y cambia hacia la derecha
                     pos_vert++;
                     pos_hor = 1;
                     cout << "\n";
                 }
             }else if (pos_vert%2==1){ //Si es numero de fila impar va para la derecho
                pos_hor++;
                if (pos_hor>m){ //Si se sale de la columna entonces baja el tubo y reinicia el contador horizontal
                    pos_vert++;
                    pos_hor=m;
                    cout << "\n";
                }
            }
            cubosUsados++;
        }
    }
    int tamCuboChico=cubosTotal-cubosUsados;//Hace un tubo chico del tamaño los cubos que sobraron
    cout <<tamCuboChico;
    for (int i=cubosUsados; i<cubosTotal; i++) {
        cout<<" "<<pos_vert<<" "<<pos_hor;
        if (pos_vert%2==0){ //Si es una fila par va para la izquierda
            pos_hor--;
            if(pos_hor<1){ //Si se sale de la columna entonces baja el tubo y cambia hacia la derecha
                pos_vert++;
                pos_hor = 1;
                //cout << "\n";
            }
        }else if (pos_vert%2==1){ //Si es numero de fila impar va para la derecha
            pos_hor++;
            if (pos_hor>m){ //Si se sale de la columna entonces baja el tubo y cambia hacia la izquierda
                pos_vert++;
                pos_hor=m;
                 //cout << "\n";
            }
        }
    }
     cout << "\n";
    return 0;
}


//
//  main.cpp
//  Tubes
//
//  Created by Tony Vazquez on 3/4/19.
//  Copyright © 2019 Tony Vazquez. All rights reserved.
//

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
int main() {
    //En el peor caso hay 1 tubo chico y lod demás grandes por si no caben del mismo tamaño

    int n,m,k; //n es filas, m es columnas y k es numero de tubos
    cin >>n>>m>>k;
    int pos_vert=1;
    int pos_hor=1; //posicion horizontal y vertical
    int cubosTotal=n*m; //Total de cuadraditos
    int tamTuboGrande=cubosTotal/k;
    int cubosUsados = 0;

    for (int i = 0; i < k - 1; i++) { //Para todos los tubos grandes
        cout <<tamTuboGrande; //Imprime tamaño

        for (int j = 0; j < tamTuboGrande; j++) { //Para cada tubo imprime su cuadrado y se recorre
            cout<<" "<<pos_vert<<" "<<pos_hor; //imprime la posicion actual
             if (pos_vert%2==1){ //Si es numero de fila impar va para la derecho

                 pos_hor++;
                 if (pos_hor>m){ //Si se sale de la columna entonces baja el tubo y reinicia el contador horizontal
                     pos_vert++;
                     pos_hor=m;

                 }
             }else {//Si es una fila par va para la izquierda
                 pos_hor--;
                 if(pos_hor<1){ //Si se sale de la columna entonces baja el tubo y cambia hacia la derecha
                     pos_vert++;
                     pos_hor = 1;
                 }
            }
            cubosUsados++;
        }cout << "\n";
    }
    int tamCuboChico=cubosTotal-cubosUsados;//Hace un tubo chico del tamaño los cubos que sobraron
    cout <<tamCuboChico;
    for (int i=cubosUsados; i<cubosTotal; i++) {
        cout<<" "<<pos_vert<<" "<<pos_hor;
        if (pos_vert%2==1){ //Si es numero de fila impar va para la derecho

            pos_hor++;
            if (pos_hor>m){ //Si se sale de la columna entonces baja el tubo y reinicia el contador horizontal
                pos_vert++;
                pos_hor=m;

            }
        }else {//Si es una fila par va para la izquierda
            pos_hor--;
            if(pos_hor<1){ //Si se sale de la columna entonces baja el tubo y cambia hacia la derecha
                pos_vert++;
                pos_hor = 1;
            }
        }
    }
     cout << "\n";
    return 0;
}


//
//  main.cpp
//  Tubes
//
//  Created by Tony Vazquez on 3/4/19.
//  Copyright © 2019 Tony Vazquez. All rights reserved.
//

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

int main() {
    //En el peor caso hay 1 tubo chico y lod demás grandes por si no caben del mismo tamaño

    int n,m,k; //n es filas, m es columnas y k es numero de tubos
    cin >>n>>m>>k;
    int pos_vert=1;
    int pos_hor=1; //posicion horizontal y vertical
    int cubosTotal=n*m; //Total de cuadraditos
    int tamTuboGrande=cubosTotal/k;
    int cubosUsados = 0;

    for (int i = 0; i < k - 1; i++) { //Para todos los tubos grandes
        cout <<tamTuboGrande; //Imprime tamaño

        for (int j = 0; j < tamTuboGrande; j++) { //Para cada tubo imprime su cuadrado y se recorre
            cout<<" "<<pos_vert<<" "<<pos_hor; //imprime la posicion actual
            /*
            if (pos_vert%2!=1){ //Si es una fila par va para la izquierda
                 pos_hor--;
                 if(pos_hor<1){ //Si se sale de la columna entonces baja el tubo y cambia hacia la derecha
                     pos_vert++;
                     pos_hor = 1;
                     cout << "\n";
                 }
             }else if (pos_vert%2==1){ //Si es numero de fila impar va para la derecho
               */ pos_hor++;
                if (pos_hor>m){ //Si se sale de la columna entonces baja el tubo y reinicia el contador horizontal
                    pos_vert++;
                    pos_hor=1;
                    cout << "\n";
                }
            //}
            cubosUsados++;
        }
    }
    int tamCuboChico=cubosTotal-cubosUsados;//Hace un tubo chico del tamaño los cubos que sobraron
    cout <<tamCuboChico;
    for (int i=cubosUsados; i<cubosTotal; i++) {
        cout<<" "<<pos_vert<<" "<<pos_hor;
        /*if (pos_vert%2!=0){ //Si es una fila par va para la izquierda
            pos_hor--;
            if(pos_hor<1){ //Si se sale de la columna entonces baja el tubo y cambia hacia la derecha
                pos_vert++;
                pos_hor = 1;
                //cout << "\n";
            }
        }else if (pos_vert%2==1){*/ //Si es numero de fila impar va para la derecha
            pos_hor++;
            if (pos_hor>m){ //Si se sale de la columna entonces baja el tubo y cambia hacia la izquierda
                pos_vert++;
                pos_hor=1;
                 //cout << "\n";
            }
        //}
    }
     cout << "\n";
    return 0;
}


//
//  main.cpp
//  Tubes
//
//  Created by Tony Vazquez on 3/4/19.
//  Copyright © 2019 Tony Vazquez. All rights reserved.
//

#include <iostream>
using namespace std;

int main(int argc, const char * argv[]) {
    //En el peor caso hay 1 tubo chico y lod demás grandes por si no caben del mismo tamaño

    int n,m,k; //n es filas, m es columnas y k es numero de tubos
    cin >>n>>m>>k;
    int pos_vert=1;
    int pos_hor=1; //posicion horizontal y vertical
    int cubosTotal=n*m; //Total de cuadraditos
    int tamTuboGrande=cubosTotal/k;
    int cubosUsados = 0;

    for (int i = 0; i < k - 1; i++) { //Para todos los tubos grandes
        cout <<tamTuboGrande; //Imprime tamaño

        for (int j = 0; j < tamTuboGrande; j++) { //Para cada tubo imprime su cuadrado y se recorre
            cout<<" "<<pos_vert<<" "<<pos_hor; //imprime la posicion actual
            pos_hor++;
            if (pos_hor>m){ //Si se sale de la columna entonces baja el tubo y reinicia el contador horizontal
                pos_vert++;
                pos_hor=1;
                cout << "\n";
            }
            cubosUsados++;
        }
    }
    int tamCuboChico=cubosTotal-cubosUsados;//Hace un tubo chico del tamaño los cubos que sobraron
    cout <<tamCuboChico;
    for (int i=cubosUsados; i<cubosTotal; i++) {
        cout<<" "<<pos_vert<<" "<<pos_hor;
        if (pos_vert%2==0){ //Si es una fila par va para la izquierda
            pos_hor--;
            if(pos_hor<1){ //Si se sale de la columna entonces baja el tubo y cambia hacia la derecha
                pos_vert++;
                pos_hor = 1;
                //cout << "\n";
            }
        }else if (pos_vert%2==1){ //Si es numero de fila impar va para la derecha
            pos_hor++;
            if (pos_hor>m){ //Si se sale de la columna entonces baja el tubo y cambia hacia la izquierda
                pos_vert++;
                pos_hor=m;
                 //cout << "\n";
            }
        }
    }
     cout << "\n";
    return 0;
}


//
//  main.cpp
//  Tubes
//
//  Created by Tony Vazquez on 3/4/19.
//  Copyright © 2019 Tony Vazquez. All rights reserved.
//

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

int main() {
    //En el peor caso hay 1 tubo chico y lod demás grandes por si no caben del mismo tamaño

    int n,m,k; //n es filas, m es columnas y k es numero de tubos
    cin >>n>>m>>k;
    int pos_vert=1;
    int pos_hor=1; //posicion horizontal y vertical
    int cubosTotal=n*m; //Total de cuadraditos
    int tamTuboGrande=cubosTotal/k;
    int cubosUsados = 0;

    for (int i = 0; i < k - 1; i++) { //Para todos los tubos grandes
        cout <<tamTuboGrande; //Imprime tamaño

        for (int j = 0; j < tamTuboGrande; j++) { //Para cada tubo imprime su cuadrado y se recorre
            cout<<" "<<pos_vert<<" "<<pos_hor; //imprime la posicion actual
            /*
            if (pos_vert%2!=1){ //Si es una fila par va para la izquierda
                 pos_hor--;
                 if(pos_hor<1){ //Si se sale de la columna entonces baja el tubo y cambia hacia la derecha
                     pos_vert++;
                     pos_hor = 1;
                     cout << "\n";
                 }
             }else if (pos_vert%2==1){ //Si es numero de fila impar va para la derecho
               */ pos_hor++;
                if (pos_hor>m){ //Si se sale de la columna entonces baja el tubo y reinicia el contador horizontal
                    pos_vert++;
                    pos_hor=1;
                    cout << "\n";
                }
            //}
            cubosUsados++;
        }
    }
    int tamCuboChico=cubosTotal-cubosUsados;//Hace un tubo chico del tamaño los cubos que sobraron
    cout <<tamCuboChico;
    for (int i=cubosUsados; i<cubosTotal; i++) {
        cout<<" "<<pos_vert<<" "<<pos_hor;
        if (pos_vert%2!=0){ //Si es una fila par va para la izquierda
            pos_hor--;
            if(pos_hor<1){ //Si se sale de la columna entonces baja el tubo y cambia hacia la derecha
                pos_vert++;
                pos_hor = 1;
                //cout << "\n";
            }
        }else if (pos_vert%2==1){//Si es numero de fila impar va para la derecha
            pos_hor++;
            if (pos_hor>m){ //Si se sale de la columna entonces baja el tubo y cambia hacia la izquierda
                pos_vert++;
                pos_hor=m;
                 //cout << "\n";
            }
        }
    }
     cout << "\n";
    return 0;
}


#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
#define rg register
#define ll long long
#define inf 0x3f3f3f3f
int n,m,k,len,x,y;
int main(){
    //freopen("a.in","r",stdin);
    scanf("%d%d%d",&n,&m,&k);
    len=n*m/k;
    x=1,y=1;
    for(int i=1;i<=k-1;i++)
    {
        int l=1;
        printf("%d ",len);
        while(l<=len)
        {
            printf("%d %d ",x,y);
            y+=((x&1)?1:-1);
            if(y==0)
                y=1,x++;
            else if(y==m+1)
                y=m,x++;
            l++;
        }
        printf("\n");
    }
    printf("%d ",n*m-len*(k-1));
    int l=1;
    len=n*m-len*(k-1);
    //printf("%d ",len);
    while(l<=len)
    {
        printf("%d %d ",x,y);
        y+=((x&1)?1:-1);
        if(y==0)
            y=1,x++;
        else if(y==m+1)
            y=m,x++;
        l++;
    }
    printf("\n");
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int mmap[310][310];
int main()
{
    int n,m,k;
    while(cin>>n>>m>>k)
    {
        int t=n*m-(k-1)*2;
        int x=1,y=1;
        printf("%d",t);
        while(t--)
        {
            printf(" %d %d",x,y);
            mmap[x][y]=1;
            if(y+1<=m&&!mmap[x][y+1])
            {
                y++;
            }
            else if(y-1>=1&&!mmap[x][y-1])
                y--;
            else x++;
        }
        k--;
        while(k--)
        {
            printf("\n2");
            t=2;
            while(t--)
            {
                printf(" %d %d",x,y);
                mmap[x][y]=1;
                if(y+1<=m&&!mmap[x][y+1])
                {
                    y++;
                }
                else if(y-1>=1&&!mmap[x][y-1])
                    y--;
                else x++;
            }
        }
        printf("\n");
    }
    return 0;
}


#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
ll n,m,k;

int main()
{
	freopen("in (2).txt","r",stdin);
	freopen("out(2).txt","w",stdout);
	scanf("%lld %lld %lld",&n,&m,&k);
	ll px=1,py=1;
	ll hang=1;
	ll dir=1;
	while(k>1){
		cout<<2;
		cout<<" "<<py<<" "<<px;
		px+=dir;
		if(px>m){
			px=m;
			dir=-1;
			py++;
		}
		else if(px<=0){
			px=1;
			dir=1;
			py++;
		}
		cout<<" "<<py<<" "<<px;
		putchar('\n');
		px+=dir;
		if(px>m){
			px=m;
			dir=-1;
			py++;
		}
		else if(px<=0){
			px=1;
			dir=1;
			py++;
		}
		k--;
	}
	ll left=0;
	if(px==m||px==1){
		left=(n-py+1)*m;
	}
	else{
		left=m-px+1+(n-py)*m;
	}
	cout<<left;
	while(!(py>n)){
		cout<<" "<<py<<" "<<px;
		px+=dir;
		if(px>m){
			px=m;
			dir=-1;
			py++;
		}
		else if(px<=0){
			px=1;
			dir=1;
			py++;
		}
	}
	putchar('\n');
	return 0;
}


#include <iostream>
#include <cstdio>
using namespace std;
//19260817
int main()
{
    int n,m,k;
    while(~scanf("%d%d%d",&n,&m,&k))
    {
        int all = n * m;
        int num = 0;
        int i = 1;
        int x = 1;
        int y = 1;
        while(x <= n && y <= m)
        {
            while(y <= m)
            {
                if(i < k && num == 0)
                {
                    printf("%d %d %d",2,x,y);
                    ++num;
                }
                else if(i < k && num == 1)
                {
                    printf(" %d %d\n",x,y);
                    num = 0;
                    ++i;
                }
                else if(i == k)
                {
                    ++i;
                    printf("%d %d %d",all - k * 2 + 2,x,y);
                }
                else if(i > k)
                {
                    printf(" %d %d",x,y);
                }
                y++;
            }
            y--;
            x++;
            if(x > n)break;
            while(y >= 1)
            {
                if(i < k && num == 0)
                {
                    printf("%d %d %d",2,x,y);
                    ++num;
                }
                else if(i < k && num == 1)
                {
                    printf(" %d %d\n",x,y);
                    num = 0;
                    ++i;
                }
                else if(i == k)
                {
                    ++i;
                    printf("%d %d %d",all - k * 2 + 2,x,y);
                }
                else if(i > k)
                {
                    printf(" %d %d",x,y);
                }
                y--;
            }
            y++;x++;
        }
        printf("\n");
    }
    return 0;
}


#include<bits/stdc++.h>
#define N 305
using namespace std;
int n,m,k,len,lastl,cnt=0,kl;
int a[N][N];
inline int read()
{
	int num=0;
	char c=getchar();
	while(c>'9'||c<'0'){c=getchar();}
	while(c>='0'&&c<='9'){num=num*10+c-'0';c=getchar();}
	return num;
}
int main()
{
	n=read();m=read();k=read();
	len=n*m/k;lastl=n*m-k*len+len;kl=len;
	for(int i=1;i<=n;i++)
	{

		if(i%2)
			for(int j=1;j<=m;j++)
			{
				if(kl==len)
				{
					kl=0,cnt++;
					if(cnt==k)
						printf("\n%d ",lastl);
					else
						printf("\n%d ",len);
				}
				printf("%d %d ",i,j);kl++;
			}
		else
			for(int j=m;j>=1;j--)
			{
				if(kl==len)
					kl=0,cnt++,printf("\n%d ",cnt);
				printf("%d %d ",i,j);kl++;
			}
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int n,m,k,px,py,dt,cnt,last;
int main()
{
	cin>>n>>m>>k;
	px=1,py=0,dt=1,cnt=0,last=n*m;
	if(k>1)cout<<"2 ";
	while(k>1)
	{
		py+=dt;
		if(py==m+1||py==0)
		{
			dt*=-1;
			py+=dt;
			px++;
		}
		cout<<px<<" "<<py<<" ";
		last--;
		cnt++;
		if(cnt==2)
		{
			k--;
			cnt=0;
			cout<<"\n";
			if(k>1)cout<<"2 ";
		}
	}
	cout<<last<<" ";
	while(last>0)
	{
		last--;
		py+=dt;
		if(py==m+1||py==0)
		{
			dt*=-1;
			py+=dt;
			px++;
		}
		cout<<px<<" "<<py<<" ";
	}
	return 0;
}


# include <iostream>
# include <algorithm>
# include <math.h>
# include <cmath>
# include <vector>
# include <map>
# include <set>
# include <queue>
# include <bits/stdc++.h>

typedef long long ll;
typedef long double ld;

using namespace std;

#define pb push_back
#define ppb pop_back
#define mp make_pair

const ll N = 1e5 + 10;
const ll MOD = 1e9 + 7;
const ll EPS = 1;
const ld e = 2.7182818284590452353602875;

ll n, m, k, t, cnt;

vector < ll > l, r;

main() {
///    ios_base::sync_with_stdio(false);
///    cin.tie(false);
///    cout.tie(false);
     cin >> n >> m >> k;
     t = (n * m) / k;
     for(int i = 1;i <= n;i++) {
         if(i % 2 == 0) {
            for(int j = m;j >= 1;j--) {
                l.pb(i);
                r.pb(j);
            }
         }
         else {
            for(int j = 1;j <= m;j++) {
                l.pb(i);
                r.pb(j);
            }
         }
     }
     cout << t << " ";
     ll kol = 1;
     for(int i = 0;i < l.size();i++) {
         cnt++;
         cout << l[i] << " " << r[i] << " ";
         if(i == l.size() - 1) {
            continue;
         }
         if(cnt == n * m - (n * m) % k - k && (n * m) % k != 0) {
            cout << '\n';
            cout << t + 1 << " ";
            kol++;
         }
         else {
            if(cnt % t == 0 && kol < k) {
               cout << '\n';
               cout << t << " ";
               kol++;
            }
         }
     }
     return 0;
}


# include <iostream>
# include <algorithm>
# include <math.h>
# include <cmath>
# include <vector>
# include <map>
# include <set>
# include <queue>
# include <bits/stdc++.h>

typedef long long ll;
typedef long double ld;

using namespace std;

#define pb push_back
#define ppb pop_back
#define mp make_pair

const ll N = 1e5 + 10;
const ll MOD = 1e9 + 7;
const ll EPS = 1;
const ld e = 2.7182818284590452353602875;

ll n, m, k, t, cnt;

vector < ll > l, r;

main() {
///    ios_base::sync_with_stdio(false);
///    cin.tie(false);
///    cout.tie(false);
     cin >> n >> m >> k;
     t = (n * m) / k;
     for(int i = 1;i <= n;i++) {
         if(i % 2 == 0) {
            for(int j = m;j >= 1;j--) {
                l.pb(i);
                r.pb(j);
            }
         }
         else {
            for(int j = 1;j <= m;j++) {
                l.pb(i);
                r.pb(j);
            }
         }
     }
     cout << t << " ";
     ll kol = 1;
     for(int i = 0;i < l.size();i++) {
         cnt++;
         cout << l[i] << " " << r[i] << " ";
         if(i == l.size() - 1) {
            continue;
         }
         if(kol == k - 1 && (n * m) % k != 0 && cnt % t == 0) {
            cout << '\n';
            cout << t + 1 << " ";
            kol++;
         }
         else {
            if(cnt % t == 0 && kol < k) {
               cout << '\n';
               cout << t << " ";
               kol++;
            }
         }
     }
     return 0;
}


# include <iostream>
# include <algorithm>
# include <math.h>
# include <cmath>
# include <vector>
# include <map>
# include <set>
# include <queue>
# include <bits/stdc++.h>

typedef long long ll;
typedef long double ld;

using namespace std;

#define pb push_back
#define ppb pop_back
#define mp make_pair

const ll N = 1e5 + 10;
const ll MOD = 1e9 + 7;
const ll EPS = 1;
const ld e = 2.7182818284590452353602875;

ll n, m, k, t, cnt;

vector < ll > l, r;

main() {
///    ios_base::sync_with_stdio(false);
///    cin.tie(false);
///    cout.tie(false);
     cin >> n >> m >> k;
     t = (n * m) / k;
     for(int i = 1;i <= n;i++) {
         if(i % 2 == 0) {
            for(int j = m;j >= 1;j--) {
                l.pb(i);
                r.pb(j);
            }
         }
         else {
            for(int j = 1;j <= m;j++) {
                l.pb(i);
                r.pb(j);
            }
         }
     }
     cout << t << " ";
     ll kol = 1;
     for(int i = 0;i < l.size();i++) {
         cnt++;
         cout << l[i] << " " << r[i] << " ";
         if(i == l.size() - 1) {
            continue;
         }
         if(kol == k - 1 && (n * m) % k != 0) {
            cout << '\n';
            cout << t + 1 << " ";
            kol++;
         }
         else {
            if(cnt % t == 0 && kol < k) {
               cout << '\n';
               cout << t << " ";
               kol++;
            }
         }
     }
     return 0;
}


# include <iostream>
# include <algorithm>
# include <math.h>
# include <cmath>
# include <vector>
# include <map>
# include <set>
# include <queue>
# include <bits/stdc++.h>

typedef long long ll;
typedef long double ld;

using namespace std;

#define pb push_back
#define ppb pop_back
#define mp make_pair

const ll N = 1e5 + 10;
const ll MOD = 1e9 + 7;
const ll EPS = 1;
const ld e = 2.7182818284590452353602875;

ll n, m, k, t, cnt;

vector < ll > l, r;

main() {
///    ios_base::sync_with_stdio(false);
///    cin.tie(false);
///    cout.tie(false);
     cin >> n >> m >> k;
     t = (n * m) / k;
     for(int i = 1;i <= n;i++) {
         if(i % 2 == 0) {
            for(int j = m;j >= 1;j--) {
                l.pb(i);
                r.pb(j);
            }
         }
         else {
            for(int j = 1;j <= m;j++) {
                l.pb(i);
                r.pb(j);
            }
         }
     }
     cout << t << " ";
     ll kol = 1;
     for(int i = 0;i < l.size();i++) {
         cnt++;
         cout << l[i] << " " << r[i] << " ";
         if(i == l.size() - 1) {
            continue;
         }
         if(kol == k - 1 && (n * m) % k != 0 && cnt % t == 0) {
            cout << '\n';
            cout << t + (n * m) % k << " ";
            kol++;
         }
         else {
            if(cnt % t == 0 && kol < k) {
               cout << '\n';
               cout << t << " ";
               kol++;
            }
         }
     }
     return 0;
}


# include <iostream>
# include <algorithm>
# include <math.h>
# include <cmath>
# include <vector>
# include <map>
# include <set>
# include <queue>
# include <bits/stdc++.h>

typedef long long ll;
typedef long double ld;

using namespace std;

#define pb push_back
#define ppb pop_back
#define mp make_pair

const ll N = 1e5 + 10;
const ll MOD = 1e9 + 7;
const ll EPS = 1;
const ld e = 2.7182818284590452353602875;

ll n, m, k, t, cnt;

vector < ll > l, r;

main() {
///    ios_base::sync_with_stdio(false);
///    cin.tie(false);
///    cout.tie(false);
     cin >> n >> m >> k;
     t = (n * m) / k;
     for(int i = 1;i <= n;i++) {
         if(i % 2 == 0) {
            for(int j = m;j >= 1;j--) {
                l.pb(i);
                r.pb(j);
            }
         }
         else {
            for(int j = 1;j <= m;j++) {
                l.pb(i);
                r.pb(j);
            }
         }
     }
     cout << t << " ";
     for(int i = 0;i < l.size();i++) {
         cnt++;
         cout << l[i] << " " << r[i] << " ";
         if(i == l.size() - 1) {
            continue;
         }
         if(cnt == n * m && (n * m) % k != 0) {
            cout << '\n';
            cout << t + 1 << " ";
         }
         else {
            if(cnt % t == 0) {
               cout << '\n';
               cout << t << " ";
            }
         }
     }
     return 0;
}


#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <string>
#include <string.h>
#include <stdio.h>

#define mp make_pair
#define maxn 301
#define mod 1000000007

using namespace std;

typedef long long lint;
typedef long double ld;

int n, m, k;
vector<pair<int,int>> kare[maxn*maxn];

int main()
{
	ios_base::sync_with_stdio(0);
	cin >> n >> m >> k;

	int o = 1;
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= m; j++)
		{
			if (o > k)continue;
			if (k-o == 1 && i != n)
			{
				if (j == m)
				{
					kare[o-1].push_back(mp(i, j));
					continue;
				}
				for (int x = j; x <= m; x++)
					kare[o].push_back(mp(i, x));
				o++;
				for (int i2 = i + 1; i2 <= n; i2++)
				{
					if (i2 <= n)
						for (int j2 = 1; j2 <= m; j2++)
							kare[o].push_back(mp(i2, j2));
					i2++;
					if (i2 <= n)
						for (int j2 = m; j2 >= 1; j2--)
							kare[o].push_back(mp(i2, j2));
				}

				o++;
			}
			else if (k-o == 0)
			{
				for (int j2 = m; j2 >= j; j2--)
					kare[o].push_back(mp(i, j2));
				for (int i2 = i + 1; i2 <= n; i2++)
				{
					if (i2 <= n)
						for (int j2 = 1; j2 <= m; j2++)
							kare[o].push_back(mp(i2, j2));
					i2++;
					if (i2 <= n)
						for (int j2 = m; j2 >= 1; j2--)
							kare[o].push_back(mp(i2, j2));
				}
				o++;
			}
			else
			{
				if (j == m)
				{
					kare[o - 1].push_back(mp(i, j));
					continue;
				}
				kare[o].push_back(mp(i, j));
				kare[o++].push_back(mp(i, j + 1));j++;
			}
		}
	}

	for (int i = 1; i <= k; i++)
	{
		cout << kare[i].size() << " ";
		for (int j = 0; j < kare[i].size(); j++)
		{
			cout << kare[i][j].first << " ";
			cout << kare[i][j].second << " ";
		}
		cout << endl;
	}
	return 0;
}


#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <string>
#include <string.h>
#include <stdio.h>

#define mp make_pair
#define maxn 301
#define mod 1000000007

using namespace std;

typedef long long lint;
typedef long double ld;

int n, m, k;
vector<pair<int,int>> kare[maxn*maxn];
int used[maxn][maxn];

int main()
{
	ios_base::sync_with_stdio(0);
	cin >> n >> m >> k;

	int o = 1;
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= m; j++)
		{
			if (o > k)continue;
			if (j == m)continue;
			kare[o].push_back(mp(i, j));
			kare[o].push_back(mp(i, j+1));
			used[i][j] = o;
			used[i][j+1] = o;
			j++;
			o++;
		}
	}
	if (o > k)
	{
		for (int i = 1; i <= n; i++)
		{
			if (k != used[i][m - 1] && used[i][m - 1])
				kare[used[i][m - 1]].push_back(mp(i, m));
			else
			{
				for (int j = kare[k][1].second + 1; j <= m; j++)
					kare[k].push_back(mp(kare[k][1].first, j));

				for (int i2 = kare[k][1].first + 1; i2 <= n; i2++)
				{
					if(i2 <= n)
						for (int j = m; j >= 1; j--)
							kare[k].push_back(mp(i2, j));
					i2++;
					if (i2 <= n)
						for (int j = 1; j <= m; j++)
							kare[k].push_back(mp(i2, j));
				}
				break;
			}
		}
	}
	else
	{
		int kal = -1;
		for (int i = 1; i < n; i++)
		{
			if (o >= k)continue;
			kal = i + 1;
			kare[o].push_back(mp(i, m));
			kare[o].push_back(mp(i+1, m));
			i++;
			o++;
		}
		for (int i = kal; i <= n; i++)
			kare[o].push_back(mp(i, m));
		o++;
	}
	for (int i = 1; i <= k; i++)
	{
		cout << kare[i].size() << " ";
		for (int j = 0; j < kare[i].size(); j++)
		{
			cout << kare[i][j].first << " ";
			cout << kare[i][j].second << " ";
		}
		cout << endl;
	}
	return 0;
}


#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <string>
#include <string.h>
#include <stdio.h>

#define mp make_pair
#define maxn 301
#define mod 1000000007

using namespace std;

typedef long long lint;
typedef long double ld;

int n, m, k;
vector<pair<int,int>> kare[maxn*maxn];
int used[maxn][maxn];

int main()
{
	freopen("a.txt", "w", stdout);
	ios_base::sync_with_stdio(0);
	cin >> n >> m >> k;

	int o = 1;
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= m; j++)
		{
			if (o > k)continue;
			if (j == m)continue;
			kare[o].push_back(mp(i, j));
			kare[o].push_back(mp(i, j+1));
			used[i][j] = o;
			used[i][j+1] = o;
			j++;
			o++;
		}
	}
	if (o > k)
	{
		for (int i = 1; i <= n; i++)
		{
			if (k != used[i][m - 1] && used[i][m - 1] && !used[i][m])
				kare[used[i][m - 1]].push_back(mp(i, m));
			else
			{
				for (int j = kare[k][1].second + 1; j <= m; j++)
					kare[k].push_back(mp(kare[k][1].first, j));

				for (int i2 = kare[k][1].first + 1; i2 <= n; i2++)
				{
					if(i2 <= n)
						for (int j = m; j >= 1; j--)
							kare[k].push_back(mp(i2, j));
					i2++;
					if (i2 <= n)
						for (int j = 1; j <= m; j++)
							kare[k].push_back(mp(i2, j));
				}
				break;
			}
		}
	}
	else
	{
		int kal = 1;
		for (int i = 1; i < n; i++)
		{
			if (o >= k)continue;
			kare[o].push_back(mp(i, m));
			kare[o].push_back(mp(i+1, m));
			i++;
			kal = i + 1;
			o++;
		}
		for (int i = kal; i <= n; i++)
			kare[o].push_back(mp(i, m));
		o++;
	}
	for (int i = 1; i <= k; i++)
	{
		cout << kare[i].size() << " ";
		for (int j = 0; j < kare[i].size(); j++)
		{
			cout << kare[i][j].first << " ";
			cout << kare[i][j].second << " ";
		}
		cout << endl;
	}
	return 0;
}


#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <string>
#include <string.h>
#include <stdio.h>

#define mp make_pair
#define maxn 301
#define mod 1000000007

using namespace std;

typedef long long lint;
typedef long double ld;

int n, m, k;
vector<pair<int,int>> kare[maxn*maxn];
int used[maxn][maxn];

int main()
{
	ios_base::sync_with_stdio(0);
	cin >> n >> m >> k;

	int o = 1;
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= m; j++)
		{
			if (o > k)continue;
			if (j == m)continue;
			kare[o].push_back(mp(i, j));
			kare[o].push_back(mp(i, j+1));
			used[i][j] = o;
			used[i][j+1] = o;
			j++;
			o++;
		}
	}
	if (o > k)
	{
		for (int i = 1; i <= n; i++)
		{
			if (k != used[i][m - 1] && used[i][m - 1] && !used[i][m])
				kare[used[i][m - 1]].push_back(mp(i, m));
			else
			{
				for (int j = kare[k][1].second + 1; j <= m; j++)
					kare[k].push_back(mp(kare[k][1].first, j));

				for (int i2 = kare[k][1].first + 1; i2 <= n; i2++)
				{
					if(i2 <= n)
						for (int j = m; j >= 1; j--)
							kare[k].push_back(mp(i2, j));
					i2++;
					if (i2 <= n)
						for (int j = 1; j <= m; j++)
							kare[k].push_back(mp(i2, j));
				}
				break;
			}
		}
	}
	else
	{
		int kal = 1;
		for (int i = 1; i < n; i++)
		{
			if (o >= k)continue;
			kare[o].push_back(mp(i, m));
			kare[o].push_back(mp(i+1, m));
			i++;
			kal = i + 1;
			o++;
		}
		for (int i = kal; i <= n; i++)
			kare[o].push_back(mp(i, m));
		o++;
	}
	for (int i = 1; i <= k; i++)
	{
		cout << kare[i].size() << " ";
		for (int j = 0; j < kare[i].size(); j++)
		{
			cout << kare[i][j].first << " ";
			cout << kare[i][j].second << " ";
		}
		cout << endl;
	}
	return 0;
}


#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <string>
#include <string.h>
#include <stdio.h>

#define mp make_pair
#define maxn 301
#define mod 1000000007

using namespace std;

typedef long long lint;
typedef long double ld;

int n, m, k;
vector<pair<int,int>> kare[maxn*maxn];
int used[maxn][maxn];

int main()
{
	ios_base::sync_with_stdio(0);
	cin >> n >> m >> k;

	int o = 1;
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= m; j++)
		{
			if (o > k)continue;
			if (j == m)continue;
			kare[o].push_back(mp(i, j));
			kare[o].push_back(mp(i, j+1));
			used[i][j] = o;
			used[i][j+1] = o;
			j++;
			o++;
		}
	}
	if (o > k)
	{
		for (int i = 1; i <= n; i++)
		{
			if (k != used[i][m - 1] && used[i][m - 1])
				kare[used[i][m - 1]].push_back(mp(i, m));
			else
			{
				for (int j = kare[k][1].second + 1; j <= m; j++)
					kare[k].push_back(mp(kare[k][1].first, j));

				for (int i2 = kare[k][1].first + 1; i2 <= n; i2++)
				{
					if(i2 <= n)
						for (int j = m; j >= 1; j--)
							kare[k].push_back(mp(i2, j));
					i2++;
					if (i2 <= n)
						for (int j = 1; j <= m; j++)
							kare[k].push_back(mp(i2, j));
				}
				break;
			}
		}
	}
	else
	{
		int kal = 1;
		for (int i = 1; i < n; i++)
		{
			if (o >= k)continue;
			kare[o].push_back(mp(i, m));
			kare[o].push_back(mp(i+1, m));
			i++;
			kal = i + 1;
			o++;
		}
		for (int i = kal; i <= n; i++)
			kare[o].push_back(mp(i, m));
		o++;
	}
	for (int i = 1; i <= k; i++)
	{
		cout << kare[i].size() << " ";
		for (int j = 0; j < kare[i].size(); j++)
		{
			cout << kare[i][j].first << " ";
			cout << kare[i][j].second << " ";
		}
		cout << endl;
	}
	return 0;
}


#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <string>
#include <string.h>
#include <stdio.h>

#define mp make_pair
#define maxn 301
#define mod 1000000007

using namespace std;

typedef long long lint;
typedef long double ld;

int n, m, k;
vector<pair<int,int>> kare[maxn];

int main()
{
	ios_base::sync_with_stdio(0);
	cin >> n >> m >> k;

	int o = 1;
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= m; j++)
		{
			if (o > k)continue;
			if (k-o == 1 && i != n)
			{
				for (int x = j; x <= m; x++)
					kare[o].push_back(mp(i, x));
				o++;
				for (int i2 = i+1; i2 <= n; i2++)
					for (int j2 = 1; j2 <= m; j2++)
						kare[o].push_back(mp(i2, j2));
				o++;
			}
			else if (k-o == 0)
			{
				for (int j2 = j; j2 <= m; j2++)
					kare[o].push_back(mp(i, j2));
				for (int i2 = i + 1; i2 <= n; i2++)
					for (int j2 = 1; j2 <= m; j2++)
						kare[o].push_back(mp(i2, j2));
				o++;
			}
			else
			{
				kare[o++].push_back(mp(i, j));
			}
		}
	}

	for (int i = 1; i <= k; i++)
	{
		cout << kare[i].size() << " ";
		for (int j = 0; j < kare[i].size(); j++)
		{
			cout << kare[i][j].first << " ";
			cout << kare[i][j].second << " ";
		}
		cout << endl;
	}
	return 0;
}


#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <string>
#include <string.h>
#include <stdio.h>

#define mp make_pair
#define maxn 301
#define mod 1000000007

using namespace std;

typedef long long lint;
typedef long double ld;

int n, m, k;
vector<pair<int,int>> kare[maxn];

int main()
{
	ios_base::sync_with_stdio(0);
	cin >> n >> m >> k;

	int o = 1;
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= m; j++)
		{
			if (o > k)continue;
			if (k-o == 1 && i != n)
			{
				if (j == m)
				{
					kare[o-1].push_back(mp(i, j));
					continue;
				}
				for (int x = j; x <= m; x++)
					kare[o].push_back(mp(i, x));
				o++;
				for (int i2 = i + 1; i2 <= n; i2++)
				{
					if (i2 <= n)
						for (int j2 = 1; j2 <= m; j2++)
							kare[o].push_back(mp(i2, j2));
					i2++;
					if (i2 <= n)
						for (int j2 = m; j2 >= 1; j2--)
							kare[o].push_back(mp(i2, j2));
				}

				o++;
			}
			else if (k-o == 0)
			{
				for (int j2 = m; j2 >= j; j2--)
					kare[o].push_back(mp(i, j2));
				for (int i2 = i + 1; i2 <= n; i2++)
				{
					if (i2 <= n)
						for (int j2 = 1; j2 <= m; j2++)
							kare[o].push_back(mp(i2, j2));
					i2++;
					if (i2 <= n)
						for (int j2 = m; j2 >= 1; j2--)
							kare[o].push_back(mp(i2, j2));
				}
				o++;
			}
			else
			{
				if (j == m)
				{
					kare[o - 1].push_back(mp(i, j));
					continue;
				}
				kare[o].push_back(mp(i, j));
				kare[o++].push_back(mp(i, j + 1));j++;
			}
		}
	}

	for (int i = 1; i <= k; i++)
	{
		cout << kare[i].size() << " ";
		for (int j = 0; j < kare[i].size(); j++)
		{
			cout << kare[i][j].first << " ";
			cout << kare[i][j].second << " ";
		}
		cout << endl;
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
//
#define ll	long long int
#define	 mp	make_pair
#define pb	push_back
#define chota(a)	transform(a.begin(),a.end(),a.begin(),::tolower)
#define speed	ios_base::sync_with_stdio(0)
#define	llmax	1000000000000
#define	rep(n)	for(ll i=0;i<n;i++)
#define rep1(n)	for(int i=1;i<=n;i++)
int dp[305][305];
int n,m;
int k;
int ti=0;
vector<pair<int,int> > v[45010];

int main()
{	speed;
	cin>>n>>m;
	cin>>k;
	ti=(n*m)/k;
	int index=0;
	bool right=true;
	bool left=false;
	int cou=0;

	for(int i=1;i<=n;i++)
	{
		if(right)
		{	for(int j=1;j<=m;j++)
			{	v[index].pb(mp(i,j));

				cou++;
				if(cou==ti)
				{	cou=0,index++;
				}
			}

		}
		if(left)
		{	for(int j=m;j>=1;j--)
			{	v[index].pb(mp(i,j));
				cou++;
				if(cou==ti)
				{	cou=0,index++;
				}
			}

		}
		bool temp=right;
		right=left;
		left=temp;
	}
	for(int i=0;i<k;i++)
	{	cout<<v[i].size()<<" ";
		for(int j=0;j<v[i].size();j++)
		{	cout<<v[i][j].first<<" " <<v[i][j].second<<" ";
		}
		if(i+1==k)
		{	for(int j=0;j<v[k].size();j++)
			{	cout<<v[k][j].first<<" "<<v[k][j].second<<" " ;
			}
		}

		cout<<endl;
	}

return 0;
}


#include<bits/stdc++.h>
using namespace std;
//
#define ll	long long int
#define	 mp	make_pair
#define pb	push_back
#define chota(a)	transform(a.begin(),a.end(),a.begin(),::tolower)
#define speed	ios_base::sync_with_stdio(0)
#define	llmax	1000000000000
#define	rep(n)	for(ll i=0;i<n;i++)
#define rep1(n)	for(int i=1;i<=n;i++)
int dp[305][305];
int n,m;
int k;
int ti=0;
vector<pair<int,int> > v[45010];

int main()
{	speed;
	cin>>n>>m;
	cin>>k;
	ti=(n*m)/k;
	int index=0;
	bool right=true;
	bool left=false;
	int cou=0;

	for(int i=1;i<=n;i++)
	{
		if(right)
		{	for(int j=1;j<=m;j++)
			{	v[index].pb(mp(i,j));

				cou++;
				if(cou==ti)
				{	cou=0,index++;
				}
			}

		}
		if(left)
		{	for(int j=m;j>=1;j--)
			{	v[index].pb(mp(i,j));
				cou++;
				if(cou==ti)
				{	cou=0,index++;
				}
			}

		}
		bool temp=right;
		right=left;
		left=temp;
	}
	for(int i=k;;i++)
	{	if(v[i].empty())break;

		for(int j=0;j<v[i].size();j++)v[k-1].pb(v[i][j]);
	}

	for(int i=0;i<k;i++)
	{	cout<<v[i].size()<<" ";
		for(int j=0;j<v[i].size();j++)
		{	cout<<v[i][j].first<<" " <<v[i][j].second<<" ";
		}

		cout<<endl;
	}

return 0;
}


#include<bits/stdc++.h>
using namespace std;
//
#define ll	long long int
#define	 mp	make_pair
#define pb	push_back
#define chota(a)	transform(a.begin(),a.end(),a.begin(),::tolower)
#define speed	ios_base::sync_with_stdio(0)
#define	llmax	1000000000000
#define	rep(n)	for(ll i=0;i<n;i++)
#define rep1(n)	for(int i=1;i<=n;i++)
int dp[305][305];
int n,m;
int k;
int ti=0;
vector<pair<int,int> > v[45010];

int main()
{	speed;
	cin>>n>>m;
	cin>>k;
	ti=(n*m)/k;
	int index=0;
	bool right=true;
	bool left=false;
	int cou=0;

	for(int i=1;i<=n;i++)
	{
		if(right)
		{	for(int j=1;j<=m;j++)
			{	v[index].pb(mp(i,j));

				cou++;
				if(cou==ti)
				{	cou=0,index++;
				}
			}

		}
		if(left)
		{	for(int j=m;j>=1;j--)
			{	v[index].pb(mp(i,j));
				cou++;
				if(cou==ti)
				{	cou=0,index++;
				}
			}

		}
		bool temp=right;
		right=left;
		left=temp;
	}
	for(int i=0;i<k;i++)
	{	cout<<v[i].size()<<" ";
		for(int j=0;j<v[i].size();j++)
		{	cout<<v[i][j].first<<" " <<v[i][j].second<<" ";
		}
		cout<<endl;
	}

return 0;
}


#include<bits/stdc++.h>
using namespace std;
//
#define ll	long long int
#define	 mp	make_pair
#define pb	push_back
#define chota(a)	transform(a.begin(),a.end(),a.begin(),::tolower)
#define speed	ios_base::sync_with_stdio(0)
#define	llmax	1000000000000
#define	rep(n)	for(ll i=0;i<n;i++)
#define rep1(n)	for(int i=1;i<=n;i++)
int dp[305][305];
int n,m;
int k;
int ti=0;
vector<pair<int,int> > v[45010];

int main()
{	speed;
	cin>>n>>m;
	cin>>k;
	ti=(n*m)/k;
	int index=0;
	bool right=true;
	bool left=false;
	int cou=0;

	for(int i=1;i<=n;i++)
	{
		if(right)
		{	for(int j=1;j<=m;j++)
			{	v[index].pb(mp(i,j));

				cou++;
				if(cou==ti)
				{	cou=0,index++;
				}
			}

		}
		if(left)
		{	for(int j=m;j>=1;j--)
			{	v[index].pb(mp(i,j));
				cou++;
				if(cou==ti)
				{	cou=0,index++;
				}
			}

		}
		bool temp=right;
		right=left;
		left=temp;
	}
	for(int i=0;i<k;i++)
	{	cout<<v[i].size()<<" ";
		for(int j=0;j<v[i].size();j++)
		{	cout<<v[i][j].first<<" " <<v[i][j].second<<" ";
		}
		if((i+1)==k)
		{	for(int l=0;l<v[k].size();l++)cout<<v[k][l].first<<" " <<v[k][l].second<<" ";
		}

		cout<<endl;
	}

return 0;
}


#include<bits/stdc++.h>
using namespace std;
//
#define ll	long long int
#define	 mp	make_pair
#define pb	push_back
#define chota(a)	transform(a.begin(),a.end(),a.begin(),::tolower)
#define speed	ios_base::sync_with_stdio(0)
#define	llmax	1000000000000
#define	rep(n)	for(ll i=0;i<n;i++)
#define rep1(n)	for(int i=1;i<=n;i++)
int dp[305][305];
int n,m;
int k;
int ti=0;
vector<pair<int,int> > v[45010];

int main()
{	speed;
	cin>>n>>m;
	cin>>k;
	ti=(n*m)/k;
	int index=0;
	bool right=true;
	bool left=false;
	int cou=0;

	for(int i=1;i<=n;i++)
	{
		if(right)
		{	for(int j=1;j<=m;j++)
			{	v[index].pb(mp(i,j));

				cou++;
				if(cou==ti)
				{	cou=0,index++;
				}
			}
				left=true;
				right=false;
		}
		if(left)
		{	for(int j=m;j>=1;j--)
			{	v[index].pb(mp(i,j));
				cou++;
				if(cou==ti)
				{	cou=0,index++;
				}
			}
			left=false;
			right=true;
		}
	}
	for(int i=0;i<k;i++)
	{	cout<<v[i].size()<<" ";
		for(int j=0;j<v[i].size();j++)
		{	cout<<v[i][j].first<<" " <<v[i][j].second<<" ";
		}
		cout<<endl;
	}

return 0;
}


#include <bits/stdc++.h>
using namespace std;

const int N = 300 + 5;
char g [N][N];

int r, c, k, p = 0, res = 0;
vector< vector<pair<int, int> > > ans (100000);

void dfs (int linha, int coluna) {
  if (linha < 0 || coluna < 0 || linha >= r || coluna >= c || res == 0) return;
  if (g[linha][coluna] == '-') return;
  g[linha][coluna] = '-';
  res--;
  ans[p].push_back({linha, coluna});
  dfs (linha + 1, coluna);
  dfs (linha - 1, coluna);
  dfs (linha, coluna + 1);
  dfs (linha, coluna - 1);
}

bool cmp (const pair<int, int> a, const pair<int, int> b) {
  return (abs(a.first - b.first) + abs (a.second - b.second) == 1);
}

int main () {
  cin >> r >> c >> k;
  for (int i = 0; i < r; i++) {
    for (int j = 0; j < c; j++) {
      g[i][j] = '.';
    }
  }
  for (int i = 0; i < r; i++) {
    for (int j = 0; j < c; j++) {
      if (k == 0) goto print;
      if (g[i][j] == '-') continue;
      if (k > 1) res = 2;
      else res = 1e9;
      dfs (i, j);
      k--; p++;
    }
  }
  print:;
  for (int i = 0; i < (int) ans.size(); i++) {
    if (ans[i].size() > 0) {
      cout << ans[i].size() << ' ';
      sort (ans[i].begin(), ans[i].end(), cmp);
      for (auto it : ans[i]) {
        cout << it.first + 1 << ' ' << it.second + 1 << ' ';
      }
      cout << '\n';
    }
  }
  return 0;
}


#include <bits/stdc++.h>
using namespace std;

const int N = 300 + 5;
char g [N][N];

int r, c, k, p = 0, res = 0;
vector< vector<pair<int, int> > > ans (100000);

void dfs (int linha, int coluna) {
  if (linha < 0 || coluna < 0 || linha >= r || coluna >= c || res == 0) return;
  if (g[linha][coluna] == '-') return;
  g[linha][coluna] = '-';
  res--;
  ans[p].push_back({linha, coluna});
  dfs (linha + 1, coluna);
  dfs (linha - 1, coluna);
  dfs (linha, coluna + 1);
  dfs (linha, coluna - 1);
}

int main () {
  cin >> r >> c >> k;
  for (int i = 0; i < r; i++) {
    for (int j = 0; j < c; j++) {
      g[i][j] = '.';
    }
  }
  for (int i = 0; i < r; i++) {
    for (int j = 0; j < c; j++) {
      if (k == 0) goto print;
      if (g[i][j] == '-') continue;
      if (k > 1) res = 2;
      else res = 1e9;
      dfs (i, j);
      k--; p++;
    }
  }
  print:;
  for (int i = 0; i < (int) ans.size(); i++) {
    if (ans[i].size() > 0) {
      cout << ans[i].size() << ' ';
      for (auto it : ans[i]) {
        cout << it.first + 1 << ' ' << it.second + 1 << ' ';
      }
      cout << '\n';
    }
  }
  return 0;
}


#include <bits/stdc++.h>
using namespace std;

vector< vector<pair<int,int > > > ans (100000);

int main () {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int r, c, k, p = 0;
  cin >> r >> c >> k;
  for (int i = 0; i < r; i++) {
    for (int j = (i % 2 == 0 ? 0 : c - 1) ; (i % 2 == 0 ? j < c : j >= 0); (i % 2 == 0 ? j++ : j--)) {
      if (k == 1) {
        ans[p].push_back({i, j});
      } else {
        if (ans[p].size() < 2) {
          ans[p].push_back({i, j});
        } else {
          k--;
          ans[++p].push_back({i, j});
        }
      }
    }
  }
  for (int i = 0; i < (int) ans.size(); i++) {
    if (ans[i].empty()) continue;
    cout << (int) ans[i].size() << ' ';
    for (int j = 0; j < (int) ans[i].size(); j++) {
      cout << ans[i][j].first + 1 << ' ' << ans[i][j].second + 1 << ' ';
    }
    cout << '\n';
  }
  return 0;
}


#include <bits/stdc++.h>
using namespace std;

vector< vector<pair<int ,int > > > ans (100000);

int main () {
  int r, c, k;
  cin >> r >> c >> k;
  int p = 0, res = 2;
  for (int i = 0; i < r; i++) {
    if ((i & 1) == 0 ) {
      for (int j = 0; j < c; j++) {
        if (k == 1) {
          ans[p].push_back({i, j});
        } else {
          if (res > 0) {
            ans[p].push_back({i, j});
            res--;
          } else {
            p++;
            k--;
            ans[p].push_back({i, j});
            res = 1;
          }
        }
      }
    } else {
      for (int j = c - 1; j >= 0; j--) {
        if (k == 1) {
          ans[p].push_back({i, j});
        } else {
          if (res > 0) {
            ans[p].push_back({i, j});
            res--;
          } else {
            p++;
            k--;
            ans[p].push_back({i, j});
            res = 1;
          }
        }
      }
    }
  }
  for (int i = 0; i < (int) ans.size(); i++) {
    if (ans[i].empty()) continue;
    cout << (int) ans[i].size() << ' ';
    for (int j = 0; j < (int) ans[i].size(); j++) {
      cout << ans[i][j].first + 1 << ' ' << ans[i][j].second + 1 << ' ';
    }
    cout << '\n';
  }
  return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long LL;

int  N ,  M , K , i , j ;
int dx[] = {-1,0,1,0};
int dy[] = {0,-1,0,1};
//NWSE

bool inrange(int x , int y)
{
    return x>0 && x<=N && y>0 && y<=M;
}

pair < pair  < int , int > , int >  Next( int x , int y  , int dir )
{
    if(inrange(x+dx[dir],y+dy[dir]) )
        return { {x+dx[dir],y+dy[dir]}  , dir  };
    dir = dir == 1 ? 3 : 1 ;
    return { {x+dx[2],y+dy[2]}  , dir  };
}

int main()
{

    cin>>N>>M>>K;
    pair < pair < int , int > , int > Point = {{1,1},3};
    int cur_size = (N*M)/K;

    if(K==1)
    {
        cout<<N*M<<"\n";
        for(j=0;j<cur_size;++j)
        {
            cout<<Point.first.first<<" "<<Point.first.second<<" ";
            Point = Next(Point.first.first,Point.first.second,Point.second);
        }
        return 0;
    }

    for(i=0;i<K-1;++i)
    {
        cout<<cur_size<<' ';
        for(j=0;j<cur_size;++j)
        {
            cout<<Point.first.first<<" "<<Point.first.second<<" ";
            Point = Next(Point.first.first,Point.first.second,Point.second);
        }
        cout<<'\n';
    }
    cur_size += ((N*M)%K);
//    if((N*M)%K==1)
//    {
//        --cur_size;
//        cout<<cur_size<<' ';
//        for(i=0;i<cur_size;++i)
//        {
//            cout<<Point.first.first<<" "<<Point.first.second<<" ";
//            Point = Next(Point.first.first,Point.first.second,Point.second);
//        }
//        cout<<'\n';
//        cur_size = 2 ;
//        cout<<cur_size<<' ';
//        for(i=0;i<cur_size;++i)
//        {
//            cout<<Point.first.first<<" "<<Point.first.second<<" ";
//            Point = Next(Point.first.first,Point.first.second,Point.second);
//        }
//        cout<<'\n';
//        return 0;
//    }
//    else
//    {
//        cout<<cur_size<<' ';
//        for(i=0;i<cur_size;++i)
//        {
//            cout<<Point.first.first<<" "<<Point.first.second<<" ";
//            Point = Next(Point.first.first,Point.first.second,Point.second);
//        }
//        cout<<'\n';
//        cur_size = N*M%K;
//    }

    cout<<cur_size<<' ';
    for(i=0;i<cur_size;++i)
    {
        cout<<Point.first.first<<" "<<Point.first.second<<" ";
        Point = Next(Point.first.first,Point.first.second,Point.second);
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long LL;

int  N ,  M , K , i , j ;
int dx[] = {-1,0,1,0};
int dy[] = {0,-1,0,1};
//NWSE

bool inrange(int x , int y)
{
    return x>0 && x<=N && y>0 && y<=M;
}

pair < pair  < int , int > , int >  Next( int x , int y  , int dir )
{
    if(inrange(x+dx[dir],y+dy[dir]) )
        return { {x+dx[dir],y+dy[dir]}  , dir  };
    dir = dir == 1 ? 3 : 1 ;
    return { {x+dx[2],y+dy[2]}  , dir  };
}

int main()
{

    cin>>N>>M>>K;
    pair < pair < int , int > , int > Point = {{1,1},3};
    int cur_size = (N*M)/K;
    for(i=0;i<K-2;++i)
    {
        cout<<cur_size<<' ';
        for(j=0;j<cur_size;++j)
        {
            cout<<Point.first.first<<" "<<Point.first.second<<" ";
            Point = Next(Point.first.first,Point.first.second,Point.second);
        }
        cout<<'\n';
    }

    if((N*M) - (N*M)/K==1)
    {
        --cur_size;
        cout<<cur_size<<' ';
        for(i=0;i<cur_size;++i)
        {
            cout<<Point.first.first<<" "<<Point.first.second<<" ";
            Point = Next(Point.first.first,Point.first.second,Point.second);
        }
        cout<<'\n';
        cur_size = 2 ;
    }
    else
    {
        cout<<cur_size<<' ';
        for(i=0;i<cur_size;++i)
        {
            cout<<Point.first.first<<" "<<Point.first.second<<" ";
            Point = Next(Point.first.first,Point.first.second,Point.second);
        }
        cout<<'\n';
        cur_size = (N*M) - (N*M)/K;
    }

    cout<<cur_size<<' ';
    for(i=0;i<cur_size;++i)
    {
        cout<<Point.first.first<<" "<<Point.first.second<<" ";
        Point = Next(Point.first.first,Point.first.second,Point.second);
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long LL;

int  N ,  M , K , i , j ;
int dx[] = {-1,0,1,0};
int dy[] = {0,-1,0,1};
//NWSE

bool inrange(int x , int y)
{
    return x>0 && x<=N && y>0 && y<=M;
}

pair < pair  < int , int > , int >  Next( int x , int y  , int dir )
{
    if(inrange(x+dx[dir],y+dy[dir]) )
        return { {x+dx[dir],y+dy[dir]}  , dir  };
    dir = dir == 1 ? 3 : 1 ;
    return { {x+dx[2],y+dy[2]}  , dir  };
}

int main()
{
    cin>>N>>M>>K;
    pair < pair < int , int > , int > Point = {{1,1},3};
    int cur_size = (N*M)/K;

    for(i=0;i<K-1;++i)
    {
        cout<<cur_size<<' ';
        for(i=0;i<cur_size;++i)
        {
            cout<<Point.first.first<<" "<<Point.first.second<<" ";
            Point = Next(Point.first.first,Point.first.second,Point.second);
        }
        cout<<'\n';
    }

    if((N*M)%K)
    {
        cout<<(N*M)%K<<'\n';
        cur_size = (N*M)%K;

    }
    cout<<cur_size<<' ';

    for(i=0;i<cur_size;++i)
    {
        cout<<Point.first.first<<" "<<Point.first.second<<" ";
        Point = Next(Point.first.first,Point.first.second,Point.second);
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long LL;

int  N ,  M , K , i , j ;
int dx[] = {-1,0,1,0};
int dy[] = {0,-1,0,1};
//NWSE

bool inrange(int x , int y)
{
    return x>0 && x<=N && y>0 && y<=M;
}

pair < pair  < int , int > , int >  Next( int x , int y  , int dir )
{
    if(inrange(x+dx[dir],y+dy[dir]) )
        return { {x+dx[dir],y+dy[dir]}  , dir  };
    dir = dir == 1 ? 3 : 1 ;
    return { {x+dx[2],y+dy[2]}  , dir  };
}

int main()
{
    cin>>N>>M>>K;
    pair < pair < int , int > , int > Point = {{1,1},3};
    for(i=0;i<N*M;++i)
    {
        cout<<Point.first.first<<" "<<Point.first.second<<" ";
        if((i+1)%((N*M)/K)==0)
            cout<<'\n';
        Point = Next(Point.first.first,Point.first.second,Point.second);
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long LL;

int  N ,  M , K , i , j ;
int dx[] = {-1,0,1,0};
int dy[] = {0,-1,0,1};
//NWSE

bool inrange(int x , int y)
{
    return x>0 && x<=N && y>0 && y<=M;
}

pair < pair  < int , int > , int >  Next( int x , int y  , int dir )
{
    if(inrange(x+dx[dir],y+dy[dir]) )
        return { {x+dx[dir],y+dy[dir]}  , dir  };
    dir = dir == 1 ? 3 : 1 ;
    return { {x+dx[2],y+dy[2]}  , dir  };
}

int main()
{
    cin>>N>>M>>K;
    pair < pair < int , int > , int > Point = {{1,1},3};
    int cur_size = (N*M)/K;

    for(i=0;i<K-1;++i)
    {
        cout<<cur_size<<' ';
        for(i=0;i<cur_size;++i)
        {
            cout<<Point.first.first<<" "<<Point.first.second<<" ";
            Point = Next(Point.first.first,Point.first.second,Point.second);
        }
        cout<<'\n';
    }

    if((N*M)%K)
    {
//        cout<<(N*M)%K<<'\n';
        cur_size = (N*M)%K;

    }
    cout<<cur_size<<' ';

    for(i=0;i<cur_size;++i)
    {
        cout<<Point.first.first<<" "<<Point.first.second<<" ";
        Point = Next(Point.first.first,Point.first.second,Point.second);
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long LL;

int  N ,  M , K , i , j ;
int dx[] = {-1,0,1,0};
int dy[] = {0,-1,0,1};
//NWSE

bool inrange(int x , int y)
{
    return x>0 && x<=N && y>0 && y<=M;
}

pair < pair  < int , int > , int >  Next( int x , int y  , int dir )
{
    if(inrange(x+dx[dir],y+dy[dir]) )
        return { {x+dx[dir],y+dy[dir]}  , dir  };
    dir = dir == 1 ? 3 : 1 ;
    return { {x+dx[2],y+dy[2]}  , dir  };
}

int main()
{

    cin>>N>>M>>K;
    pair < pair < int , int > , int > Point = {{1,1},3};
    int cur_size = (N*M)/K;

    for(i=0;i<K-1;++i)
    {
        cout<<cur_size<<' ';
        for(j=0;j<cur_size;++j)
        {
            cout<<Point.first.first<<" "<<Point.first.second<<" ";
            Point = Next(Point.first.first,Point.first.second,Point.second);
        }
        cout<<'\n';
    }

    if((N*M)%K)
    {
        cur_size = (N*M)%K;
    }

    cout<<cur_size<<' ';
//    cout<<"HELLO";
    for(i=0;i<cur_size;++i)
    {
        cout<<Point.first.first<<" "<<Point.first.second<<" ";
        Point = Next(Point.first.first,Point.first.second,Point.second);
    }

    return 0;
}


#include <set>
#include <map>
#include <list>
#include <bitset>
#include <iostream>
#include <algorithm>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <cmath>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <sstream>
#include <fstream>
#define pi acos(-1.0)
using namespace std;
int main() {
    int n,m,k;
    cin>>n>>m>>k;
    int Cells = n*m;
    int tubeCells = Cells/k;
    int rem = Cells%k;
    int curX = 1;
    int curY = 1;
    int usedCells = 0;
    bool forward = true;
    for (int i=0; i<k; i++) {
        if (i==k-1) {
            cout<<tubeCells+rem;
        }else{
            cout<<tubeCells;
        }
        usedCells = 0;
        if (forward) {

        while (true) {
        for (int j=curY; j<=m; j++) {
            if (usedCells==tubeCells) {
                break;
            }
            cout<<" "<<curX<<" "<<j;
            usedCells++;
            curY = j;
        }
        if (usedCells<tubeCells) {
            curX++;
            for (int j=m; j>0; j--) {
                if (usedCells==tubeCells) {
                    break;
                }
                cout<<" "<<curX<<" "<<j;
                usedCells++;
                curY = j;

            }
            if (usedCells<tubeCells) {
                curX++;
                continue;
            }else{
                if (i!=k-1) {
                    cout<<"\n";
                }
                if (curY==0) {
                    forward = true;
                    curX++;
                }else{
                    forward = false;
                    curY--;
                }
                break;
            }
        }else{
            if (i!=k-1) {
                cout<<"\n";
            }
            if (curY==m) {
                forward = false;
                curX++;
            }else{
                forward = true;
                curY++;
            }
            break;
        }
        }
        }else{
            while (true) {
            for (int j=curY; j>0; j--) {
                if (usedCells==tubeCells) {
                    break;
                }
                cout<<" "<<curX<<" "<<j;
                usedCells++;
                curY = j;
            }
                if (usedCells<tubeCells) {
                    curX++;
                    for (int j=1; j<=m; j++) {
                        if (usedCells==tubeCells) {
                            break;
                        }
                        cout<<" "<<curX<<" "<<j;
                        usedCells++;
                        curY = j;
                    }
                    if (usedCells<tubeCells) {
                        curX++;
                        continue;
                    }else{
                        if (i!=k-1) {
                            cout<<"\n";
                        }
                        if (curY==m) {
                            forward = false;
                            curX++;
                        }else{
                            forward = true;
                            curY++;
                        }
                        break;
                        }
                }else{
                    if (i!=k-1) {
                        cout<<"\n";
                    }
                    if (curY==0) {
                        forward = true;
                        curX++;
                    }else{
                        forward = false;
                        curY--;
                    }
                    break;
                }
            }
        }
    }

    if (rem!=0) {
        tubeCells+=rem;
    if (forward) {

            while (true) {
                for (int j=curY; j<=m; j++) {
                    if (usedCells==tubeCells) {
                        break;
                    }
                    cout<<" "<<curX<<" "<<j;
                    usedCells++;
                    curY = j;
                }
                if (usedCells<tubeCells) {
                    curX++;
                    for (int j=m; j>0; j--) {
                        if (usedCells==tubeCells) {
                            break;
                        }
                        cout<<" "<<curX<<" "<<j;
                        usedCells++;
                        curY = j;

                    }
                    if (usedCells<tubeCells) {
                        curX++;
                        continue;
                    }else{
                        cout<<"\n";
                        if (curY==0) {
                            forward = true;
                            curX++;
                        }else{
                            forward = false;
                            curY--;
                        }
                        break;
                    }
                }else{
                    cout<<"\n";
                    if (curY==m) {
                        forward = false;
                        curX++;
                    }else{
                        forward = true;
                        curY++;
                    }
                    break;
                }
            }
        }else{
            while (true) {
                for (int j=curY; j>0; j--) {
                    if (usedCells==tubeCells) {
                        break;
                    }
                    cout<<" "<<curX<<" "<<j;
                    usedCells++;
                    curY = j;
                }
                if (usedCells<tubeCells) {
                    curX++;
                    for (int j=1; j<=m; j++) {
                        if (usedCells==tubeCells) {
                            break;
                        }
                        cout<<" "<<curX<<" "<<j;
                        usedCells++;
                        curY = j;
                    }
                    if (usedCells<tubeCells) {
                        curX++;
                        continue;
                    }else{
                        cout<<"\n";
                        if (curY==m) {
                            forward = false;
                            curX++;
                        }else{
                            forward = true;
                            curY++;
                        }
                        break;
                    }
                }else{
                    cout<<"\n";
                    if (curY==0) {
                        forward = true;
                        curX++;
                    }else{
                        forward = false;
                        curY--;
                    }
                    break;
                }
            }

    }
    }
    return 0;
}


#include <set>
#include <map>
#include <list>
#include <bitset>
#include <iostream>
#include <algorithm>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <cmath>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <sstream>
#include <fstream>
#define pi acos(-1.0)
using namespace std;
int main() {
    int n,m,k;
    cin>>n>>m>>k;
    int Cells = n*m;
    int tubeCells = Cells/k;
    int curX = 1;
    int curY = 1;
    int usedCells = 0;
    bool forward = true;
    for (int i=0; i<k; i++) {
        cout<<tubeCells;
        usedCells = 0;
        if (forward) {

        while (true) {
        for (int j=curY; j<=m; j++) {
            if (usedCells==tubeCells) {
                break;
            }
            cout<<" "<<curX<<" "<<j;
            usedCells++;
            curY = j;
        }
        if (usedCells<tubeCells) {
            curX++;
            for (int j=m; j>0; j--) {
                if (usedCells==tubeCells) {
                    break;
                }
                cout<<" "<<curX<<" "<<j;
                usedCells++;
                curY = j;

            }
            if (usedCells<tubeCells) {
                curX++;
                continue;
            }else{
                cout<<"\n";
                if (curY-1==0) {
                    forward = true;
                    curX++;
                }else{
                    forward = false;
                    curY--;
                }
                break;
            }
        }else{
            cout<<"\n";
            if (curY+1==m) {
                forward = false;
                curX++;
            }else{
                forward = true;
                curY++;
            }
            break;
        }
        }
        }else{
            while (true) {
            for (int j=curY; j>0; j--) {
                if (usedCells==tubeCells) {
                    break;
                }
                cout<<" "<<curX<<" "<<j;
                usedCells++;
                curY = j;
            }
                if (usedCells<tubeCells) {
                    curX++;
                    for (int j=1; j<=m; j++) {
                        if (usedCells==tubeCells) {
                            break;
                        }
                        cout<<" "<<curX<<" "<<j;
                        usedCells++;
                        curY = j;
                    }
                    if (usedCells<tubeCells) {
                        curX++;
                        continue;
                    }else{
                        cout<<"\n";
                        if (curY==m) {
                            forward = false;
                            curX++;
                        }else{
                            forward = true;
                            curY++;
                        }
                        break;
                        }

                }else{
                    cout<<"\n";
                    if (curY==0) {
                        forward = true;
                        curX++;
                    }else{
                        forward = false;
                        curY--;
                    }
                    break;

                }
            }

        }

    }

    return 0;
}


#include <set>
#include <map>
#include <list>
#include <bitset>
#include <iostream>
#include <algorithm>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <cmath>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <sstream>
#include <fstream>
#define pi acos(-1.0)
using namespace std;
int main() {
    int n,m,k;
    cin>>n>>m>>k;
    int Cells = n*m;
    int tubeCells = Cells/k;
    int curX = 1;
    int curY = 1;
    int usedCells = 0;
    bool forward = true;
    for (int i=0; i<k; i++) {
        cout<<tubeCells;
        usedCells = 0;
        if (forward) {

        while (true) {
        for (int j=curY; j<=m; j++) {
            if (usedCells==tubeCells) {
                break;
            }
            cout<<" "<<curX<<" "<<j;
            usedCells++;
            curY = j;
        }
        if (usedCells<tubeCells) {
            curX++;
            for (int j=m; j>0; j--) {
                if (usedCells==tubeCells) {
                    break;
                }
                cout<<" "<<curX<<" "<<j;
                usedCells++;
                curY = j;

            }
            if (usedCells<tubeCells) {
                curX++;
                continue;
            }else{
                cout<<"\n";
                if (curY-1==0) {
                    forward = true;
                    curX++;
                }else{
                    forward = false;
                    curY--;
                }
                break;
            }
        }else{
            cout<<"\n";
            if (curY+1==m) {
                forward = false;
                curX++;
            }else{
                forward = true;
                curY++;
            }
            break;
        }
        }
        }else{
            while (true) {
            for (int j=curY; j>0; j--) {
                if (usedCells==tubeCells) {
                    break;
                }
                cout<<" "<<curX<<" "<<j;
                usedCells++;
                curY = j;
            }
                if (usedCells<tubeCells) {
                    curX++;
                    for (int j=1; j<=m; j++) {
                        if (usedCells==tubeCells) {
                            break;
                        }
                        cout<<" "<<curX<<" "<<j;
                        usedCells++;
                        curY = j;
                    }
                    if (usedCells<tubeCells) {
                        curX++;
                        continue;
                    }else{
                        cout<<"\n";
                        if (curY+1==m) {
                            forward = false;
                            curX++;
                        }else{
                            forward = true;
                            curY++;
                        }
                        break;
                        }

                }else{
                    cout<<"\n";
                    if (curY-1==0) {
                        forward = true;
                        curX++;
                    }else{
                        forward = false;
                        curY--;
                    }
                    break;

                }
            }

        }

    }

    return 0;
}


#include <set>
#include <map>
#include <list>
#include <bitset>
#include <iostream>
#include <algorithm>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <cmath>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <sstream>
#include <fstream>
#define pi acos(-1.0)
using namespace std;
int main() {
    int n,m,k;
    cin>>n>>m>>k;
    int Cells = n*m;
    int tubeCells = Cells/k;
    int curX = 1;
    int curY = 1;
    int usedCells = 0;
    bool forward = true;
    for (int i=0; i<k; i++) {
        cout<<tubeCells;
        usedCells = 0;
        if (forward) {

        while (true) {
        for (int j=curY; j<=m; j++) {
            if (usedCells==tubeCells) {
                break;
            }
            cout<<" "<<curX<<" "<<j;
            usedCells++;
            curY = j;
        }
        if (usedCells<tubeCells) {
            curX++;
            for (int j=m; j>0; j--) {
                if (usedCells==tubeCells) {
                    break;
                }
                cout<<" "<<curX<<" "<<j;
                usedCells++;
                curY = j;

            }
            if (usedCells<tubeCells) {
                curX++;
                continue;
            }else{
                cout<<"\n";
                if (curY==0) {
                    forward = true;
                    curX++;
                }else{
                    forward = false;
                    curY--;
                }
                break;
            }
        }else{
            cout<<"\n";
            if (curY==m) {
                forward = false;
                curX++;
            }else{
                forward = true;
                curY++;
            }
            break;
        }
        }
        }else{
            while (true) {
            for (int j=curY; j>0; j--) {
                if (usedCells==tubeCells) {
                    break;
                }
                cout<<" "<<curX<<" "<<j;
                usedCells++;
                curY = j;
            }
                if (usedCells<tubeCells) {
                    curX++;
                    for (int j=1; j<=m; j++) {
                        if (usedCells==tubeCells) {
                            break;
                        }
                        cout<<" "<<curX<<" "<<j;
                        usedCells++;
                        curY = j;
                    }
                    if (usedCells<tubeCells) {
                        curX++;
                        continue;
                    }else{
                        cout<<"\n";
                        if (curY==m) {
                            forward = false;
                            curX++;
                        }else{
                            forward = true;
                            curY++;
                        }
                        break;
                        }

                }else{
                    cout<<"\n";
                    if (curY==0) {
                        forward = true;
                        curX++;
                    }else{
                        forward = false;
                        curY--;
                    }
                    break;

                }
            }

        }

    }

    return 0;
}


#include <set>
#include <map>
#include <list>
#include <bitset>
#include <iostream>
#include <algorithm>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <cmath>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <sstream>
#include <fstream>
#define pi acos(-1.0)
using namespace std;
int main() {
    int n,m,k;
    cin>>n>>m>>k;
    int Cells = n*m;
    int tubeCells = Cells/k;
    int curX = 1;
    int curY = 1;
    int usedCells = 0;
    bool forward = true;
    for (int i=0; i<k; i++) {
        cout<<tubeCells;
        usedCells = 0;
        if (forward) {

        while (true) {
        for (int j=curY; j<=m; j++) {
            if (usedCells==tubeCells) {
                break;
            }
            cout<<" "<<curX<<" "<<j;
            usedCells++;
            curY = j;
        }
        if (usedCells<tubeCells) {
            curX++;
            if (curX>n) {
                return 0;
            }
            for (int j=m; j>0; j--) {
                if (usedCells==tubeCells) {
                    break;
                }
                cout<<" "<<curX<<" "<<j;
                usedCells++;
                curY = j;

            }
            if (usedCells<tubeCells) {
                curX++;

                if (curX>n) {
                    return 0;
                }
                continue;
            }else{
                cout<<"\n";
                if (curY-1==0) {
                    forward = true;
                    curX++;
                    if (curX>n) {
                        return 0;
                    }
                }else{
                    forward = false;
                    curY--;
                }
                break;
            }
        }else{
            cout<<"\n";
            if (curY+1==m) {
                forward = false;
                curX++;
                if (curX>n) {
                    return 0;
                }
            }else{
                forward = true;
                curY++;
            }
            break;
        }
        }
        }else{
            while (true) {
            for (int j=curY; j>0; j--) {
                if (usedCells==tubeCells) {
                    break;
                }
                cout<<" "<<curX<<" "<<j;
                usedCells++;
                curY = j;
            }
                if (usedCells<tubeCells) {
                    curX++;
                    if (curX>n) {
                        return 0;
                    }
                    for (int j=1; j<=m; j++) {
                        if (usedCells==tubeCells) {
                            break;
                        }
                        cout<<" "<<curX<<" "<<j;
                        usedCells++;
                        curY = j;
                    }
                    if (usedCells<tubeCells) {
                        curX++;
                        if (curX>n) {
                            return 0;
                        }
                        continue;
                    }else{
                        cout<<"\n";
                        if (curY+1==m) {
                            forward = false;
                            curX++;
                        }else{
                            forward = true;
                            curY++;
                        }
                        break;
                        }

                }else{
                    cout<<"\n";
                    if (curY-1==0) {
                        forward = true;
                        curX++;
                        if (curX>n) {
                            return 0;
                        }

                    }else{
                        forward = false;
                        curY--;
                        if (curX>n) {
                            return 0;
                        }
                    }
                    break;

                }
            }

        }

    }

    return 0;
}


from collections import defaultdict
n = int(input())
e = defaultdict(list)
for i in range(n-1):
  tmp = input().split(' ')
  x, y = int(tmp[0]), int(tmp[1])
  e[x].append(y)
  e[y].append(x)

def dfs(v):
  global mark
  for i in e[v]:
    if mark[i-1]==0:
      mark[i-1]=mark[v-1]+1
      dfs(i)

mark = [0]*n
mark[0]=1
dfs(1)
a=0
for i in range(0,n):
  a += (mark[i]%2==1)
print(a*(n-a)-(n-1))


from collections import defaultdict
n = int(input())
e = defaultdict(list)
for i in range(n-1):
  tmp = input().split(' ')
  x, y = int(tmp[0]), int(tmp[1])
  e[x].append(y)
  e[y].append(x)

def dfs(v):
  for i in e[v]:
    if mark[i]==0:
      mark[i]=mark[v]+1
      dfs(i)

mark = defaultdict(int)
mark[1]=1
dfs(1)
a=0
for i in range(1,n+1):
  a += (mark[i]%2==1)
print(a*(n-a)-(n-1))


from collections import defaultdict
from queue import Queue as Q
n = int(input())
e = defaultdict(list)
for i in range(n-1):
  x, y = tuple(map(int, input().split()))
  e[x].append(y)
  e[y].append(x)

def bfs(v):
  mark = defaultdict(int)
  q = Q()
  q.put(v)
  mark[v] = 1
  while not q.empty():
    v = q.get()
    for i in e[v]:
      if mark[i] == 0:
        mark[i] = mark[v]*(-1)
        q.put(i)
  return sum(value==1 for value in mark.values())

a = bfs(1)
print(a*(n-a)-(n-1))


n = int(input())

uv = [[int(x) for x in input().split()] for _ in range(n-1)]

a = -n+1

li = [[] for _ in range(n+1)]

for p in uv:
    li[p[0]].append(p)
    li[p[1]].append(p)

first = 0
second = 0

queue = [1]
seen = set()

while queue:
    first += len(queue)
    a += len(queue) * second

    q2 = []
    for p in queue:
        seen.add(p)
        adjs = li[p]
        for adj in adjs:
            other = adj[0] if adj[0] != p else adj[1]
            if other in seen:
                continue
            q2.append(other)

    first, second = second, first
    queue = q2

print(a)


def read():
    n = int(input())
    edges = []
    for i in range(n - 1):
      edges.append(tuple(map(int, input().split(' '))))
    return (n, edges)

def parse_matrix(n, edges):
    matrix = [[0 for i in range(n + 1)] for j in range(n + 1)]
    for a, b in edges:
        matrix[a][b] = 1
        matrix[b][a] = 1
    return matrix

def parse_relations(n, edges):
    relations = {}
    for a, b in edges:
        if not relations.get(a):
            relations[a] = []
        if not relations.get(b):
            relations[b] = []
        relations[a].append(b)
        relations[b].append(a)
    return relations

def compute(n, edges):
    matrix = parse_matrix(n, edges)
    relations = parse_relations(n, edges)

    s1, s2 = set(), set()

    for v, neib in relations.items():
        if v in s1:
            for v_n in neib:
                s2.add(v_n)
        elif v in s2:
            for v_n in neib:
                s1.add(v_n)
        else:
            s1_has_neib = False
            for v_n in neib:
                if v_n in s1:
                    s1_has_neib = True
            if s1_has_neib:
                s2.add(v)
                for v_n in neib:
                    s1.add(v_n)
            else:
                s1.add(v)
                for v_n in neib:
                    s2.add(v_n)

    new_edges_count = 0
    for v1 in s1:
        for v2 in s2:
            if matrix[v1][v2] == 0:
                matrix[v1][v2] = 1
                matrix[v2][v1] = 1
                new_edges_count += 1

    return new_edges_count

n, edges = read()
new_edges_count = compute(n, edges)

print(new_edges_count)


def read():
    n = int(input())
    edges = []
    for i in range(n - 1):
      edges.append(tuple(map(int, input().split(' '))))
    return (n, edges)

def parse_matrix(n, edges):
    matrix = [[0 for i in range(n + 1)] for j in range(n + 1)]
    for a, b in edges:
        matrix[a][b] = 1
        matrix[b][a] = 1
    return matrix

def parse_relations(n, edges):
    relations = {}
    for a, b in edges:
        if not relations.get(a):
            relations[a] = []
        if not relations.get(b):
            relations[b] = []
        relations[a].append(b)
        relations[b].append(a)
    return relations

def compute(n, edges):
    matrix = parse_matrix(n, edges)
    relations = parse_relations(n, edges)

    s1, s2 = set(), set()

    for v, neib in relations.items():
        if v in s1:
            for v_n in neib:
                s2.add(v_n)
        elif v in s2:
            for v_n in neib:
                s1.add(v_n)
        else:
            s1_has_neib = False
            for v_n in neib:
                if v_n in s1:
                    s1_has_neib = True
            if s1_has_neib:
                s2.add(v)
                for v_n in neib:
                    s1.add(v_n)
            else:
                s1.add(v)
                for v_n in neib:
                    s2.add(v_n)

    print(s1, s2)
    new_edges_count = 0
    for v1 in s1:
        for v2 in s2:
            if matrix[v1][v2] == 0:
                matrix[v1][v2] = 1
                matrix[v2][v1] = 1
                new_edges_count += 1

    return new_edges_count

n, edges = read()
new_edges_count = compute(n, edges)

print(new_edges_count)