#include <iostream>
#include <fstream>
using namespace std;
ifstream f("immortal.in");
ofstream g("immortal.out");
int gasit = 0;
int dx[]={1,-1,0,0};
int dy[]={0,0,1,-1};
int n , m , I ;
int a[25][25] ;
struct nemuritor
{
int x,y;
}v[16];
struct solutie
{
int x1,x2,y1,y2;
}sol[16];
void afis ()
{
for ( int i = 1; i <= I-1; i++ )
g << sol[i].x1 << " " << sol[i].y1 << " " << sol[i].x2 << " " << sol[i].y2 << "\n" ;
}
bool interior ( int x , int y )
{
return x <= n and x >= 1 and y <= m and y >=1 ;
}
void afisare()
{
for ( int r = 1 ; r <= I-1 ; r++ )
{
g << sol[r].x1 << " " << sol[r].y1 << " " << sol[r+1].x2 << " " << sol[r+1].y2 << "\n" ;
}
}
void back (int nr , int lg )
{
if ( nr == 1 and !gasit)
{
gasit = 1;
afis();
return;
}
else
{
for ( int i = 1; i <= I and !gasit; i++ )
{
int ox = v[i].x;
int oy = v[i].y;
if ( a[ox][oy] == 1 )
{
if (ox >2 and a[ox-1][oy] == 1 and a[ox-2][oy] == 0 ) v[i].x-=2, a[ox-1][oy] = 0 , swap(a[ox][oy],a[ox-2][oy]), sol[lg].x1 = ox , sol[lg].y1 = oy , sol[lg].x2 = ox-2 , sol[lg].y2 = oy , back(nr-1,lg+1) , a[ox-1][oy] = 1 , swap(a[ox][oy],a[ox-2][oy]) , v[i].x+=2;;
if (ox+2 <=n and a[ox+1][oy] == 1 and a[ox+2][oy] == 0 )v[i].x+=2, a[ox+1][oy] = 0 , swap(a[ox][oy],a[ox+2][oy]), sol[lg].x1 = ox , sol[lg].y1 = oy , sol[lg].x2 = ox+2 , sol[lg].y2 = oy , back(nr-1,lg+1) , a[ox+1][oy] = 1 , swap(a[ox][oy],a[ox+2][oy]),v[i].x-=2;;
if (oy >2 and a[ox][oy-1] == 1 and a[ox][oy-2] == 0 ) v[i].y-=2, a[ox][oy-1] = 0 , swap(a[ox][oy],a[ox][oy-2]), sol[lg].x1 = ox , sol[lg].y1 = oy , sol[lg].x2 = ox , sol[lg].y2 = oy-2 , back(nr-1,lg+1) , a[ox][oy-1] = 1 , swap(a[ox][oy],a[ox][oy-2]),v[i].y+=2;
if (oy+2 <=m and a[ox][oy+1] == 1 and a[ox][oy+2] == 0 ) v[i].y+=2, a[ox][oy+1] = 0 , swap(a[ox][oy],a[ox][oy+2]), sol[lg].x1 = ox , sol[lg].y1 = oy , sol[lg].x2 = ox , sol[lg].y2 = oy+2 , back(nr-1,lg+1) , a[ox][oy+1] = 1 , swap(a[ox][oy],a[ox][oy+2]),v[i].y-=2;
}
}
}
}
int main()
{
f >> n >> m >> I;
for ( int i = 1 ; i <= I; i++ )
{
f >> v[i].x >> v[i].y ;
a[ v[i].x ][ v[i].y ] = 1;
}
int nr = I;
back(nr,1);
return 0;
}