#include<iostream>
#include<string>
using namespace std;
const int MAX_SIZE = 1000;
int n, m, k;
int a[MAX_SIZE][MAX_SIZE];
int sum;
void dfs(int x, int y) {
++sum;
a[x][y] = 1;
if ((x > 1) && (a[x-1][y] == 0)) dfs(x - 1, y);
if ((y > 1) && (a[x][y-1] == 0)) dfs(x, y - 1);
if ((x < n) && (a[x+1][y] == 0)) dfs(x + 1, y);
if ((y < m) && (a[x][y+1] == 0)) dfs(x, y + 1);
}
int main( ) {
memset(a, 0, sizeof(a));
cin >> n >> m >> k;
for(int i = 1; i <= k; ++i) {
int x, y;
cin >> x >> y;
a[x][y] = 1;
}
int ans = 0, ansp = 0;
for (int i = 1; i <= n; ++i)
for (int j = 1; j <= m; ++j)
if (a[i][j] == 0) {
++ansp;
sum = 0;
dfs(i, j);
if (ans < sum) ans = sum;
}
cout << ans << " " << ansp << endl;
return 0;
} 10 10 10
4 1
5 2
6 3
7 2
8 1
1 7
2 7
3 8
4 9
5 10