#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <queue>

using namespace std;

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

struct rhomb
{
	int x1, x2, y1, y2;
	rhomb();
	rhomb(int x, int y, int r): x1(x + y - r), x2(x + y + r), y1(x - y - r), y2(x - y + r) {};
	rhomb(int x1, int x2, int y1, int y2): x1(x1), x2(x2), y1(y1), y2(y2) {};
};

bool is_inter(rhomb a, rhomb b)
{
	return (max(a.x1, b.x1) <= min(a.x2, b.x2)) && (max(a.y1, b.y1) <= min(a.y2, b.y2));
}

rhomb inter(rhomb a, rhomb b)
{
	return rhomb(max(a.x1, b.x1), min(a.x2, b.x2), max(a.y1, b.y1), min(a.y2, b.y2));
}

int dist(pair<int, int> a, pair<int, int> b)
{
	return abs(a.first - b.first) + abs(a.second - b.second);
}

int h, w;
vector<vector<int> > d;
vector<vector<pair<int, int> > > cell;

bool in_rhomb(rhomb a, int x, int y)
{
	return (a.x1 <= x + y) && (x + y <= a.x2) && (x - y <= a.y2) && (x - y >= a.y1); 
}

bool check(int m, rhomb& ans)
{
	ans = rhomb(1, 1, h + w);
	for (int i = m + 1; i < cell.size(); i++)
		for (int j = 0; j < cell[i].size(); j++)
		{
			rhomb cur = rhomb(cell[i][j].first, cell[i][j].second, m);
			if (is_inter(ans, cur)) ans = inter(ans, cur);
			else return false;
		}
	for (int i = 1; i <= h; i++)
		for (int j = 1; j <= w; j++)
			if (in_rhomb(ans, i, j)) return true;
				
	return false;
}

bool in_field(int x, int y)
{
	return (0 <= x && x < h && 0 <= y && y < w);
}

int main()
{
	freopen("lights.in", "r", stdin);
	freopen("lights.out", "w", stdout);
	int n;
	cin >> h >> w >> n;

	vector<pair<int, int> > lights(n);
	for (int i = 0; i < n; i++)
		cin >> lights[i].first >> lights[i].second;
	queue<pair<int, int> > q;
	
	d = vector<vector<int> >(h, vector<int>(w, 1e6));
	for (int i = 0; i < n; i++)
	{
		d[--lights[i].first][--lights[i].second] = 0;
		q.push(lights[i]);
	}
	
	while (!q.empty())
	{
		int x = q.front().first;
		int y = q.front().second;
		q.pop();
		for (int i = 0; i < 4; i++)
			if (in_field(x + dx[i], y + dy[i]) && (d[x + dx[i]][y + dy[i]] > d[x][y] + 1))
			{
				d[x + dx[i]][y + dy[i]] = d[x][y] + 1;
				q.push(make_pair(x + dx[i], y + dy[i]));
			}
	}

	int ans = 0;
	for (int i = 0; i < h; i++)
		for (int j = 0; j < w; j++)
			ans = max(ans, d[i][j]);
	
	cell = vector<vector<pair<int, int> > > (ans + 1);
	for (int i = 0; i < h; i++)
		for (int j = 0; j < w; j++)
			cell[d[i][j]].push_back(make_pair(i + 1, j + 1));
	
	rhomb light = rhomb(1, 1, h + w);
	int l = -1, r = ans;

	while (l < r - 1)
	{
		int m = (l + r) / 2;
		if (check(m, light)) r = m; else l = m;
	}
		
	if (check(r, light))
	{
		cout << r << endl;
		for (int i = 1; i <= h; i++)
			for (int j = 1; j <= w; j++)
				if (in_rhomb(light, i, j))
				{
					cout << i << " " << j;
					return 0;
				}
         cout << "1 1\n";  
	}
    else return 23;
}
