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

#define endl "\n"
#define int long long int
#define mod 1000000007
#define vi vector<int>
#define pint pair<int,int>
#define vint vector<vector<int>>
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

const int N = 1e6+5;
int A[N], B[N], P[N];

int mat[1005][1005];
pint edges[N];
unordered_map<int, set<int>> m;

bool compare(vi a, vi b)
{
    return a[0] < b[0];
}

int mypow(int a, int x)
{
    if(a<=1 || x==1) return a;
    if(x==0) return 1;

    int temp = mypow(a,x/2);
    if(x%2==0) return ((temp%mod) * (temp%mod))%mod;
    else return (a%mod * ((temp%mod) * (temp%mod))%mod)%mod;
}

int count_bits(int n)
{
    int cnt = 0;
    while(n)
    {
        n = n & (n-1);
        cnt++;
    }return cnt;
}

void bfs(int src, int n)
{
    unordered_map<int, bool> visited;
    for(int i=0;i<n;i++) visited[i] = false;
    queue<int> q;
    q.push(src);
    visited[src] = true;

    while(!q.empty())
    {
        int curr = q.front();
        q.pop();
        B[curr] -= min(B[curr], A[src]);
        //cout<<curr<<" "<<endl;

        for(auto neigh: m[curr])
        {
            if(visited[neigh] == false)
            {
                //cout<<neigh<<endl;
                q.push(neigh);
                visited[neigh] = true;
                m[src].erase(neigh);
                m[neigh].erase(src);
            }
        }
    }
}

/*void void_solve(int n)
{

}*/

int int_solve(int n)
{
    int D[n][2];
    int i;
    for(i=0;i<n;i++) cin>>D[i][0]>>D[i][1];

    unordered_map<int,int> um1, um2;
    for(i=0;i<n;i++) um1[D[i][0]]++;
    for(i=0;i<n;i++) um2[D[i][1]]++;

    int maxH = 0, maxV = 0, maxVal_h, maxVal_v;
    for(auto x:um1) maxH = max(maxH, x.second);
    for(auto x:um2) maxV = max(maxV, x.second);

    if(maxH >= maxV)
    {
        maxH = 0, maxV = 0;
        for(auto x: um1)
        {
            if(x.second > maxH)
            {
                maxH = x.second;
                maxVal_h = x.first;
            }
        }

        for(i=0;i<n;i++)
        {
            if(D[i][0] == maxVal_h) um2[D[i][1]]--;
        }
        for(auto x: um2)
        {
            if(x.second > maxV)
            {
                maxV = x.second;
                maxVal_v = x.first;
            }
        }

        return maxH + maxV;
    }

    else
    {
        maxH = 0, maxV = 0;
        for(auto x: um2)
        {
            if(x.second > maxV)
            {
                maxV = x.second;
                maxVal_v = x.first;
            }
        }
        for(i=0;i<n;i++)
        {
            if(D[i][1] == maxVal_v) um1[D[i][0]]--;
        }
        for(auto x: um1)
        {
            if(x.second > maxH)
            {
                maxH = x.second;
                maxVal_h = x.first;
            }
        }
        return maxH + maxV;
    }










    /*for(auto x: um1)
    {
        if(x.second > maxH)
        {
            maxH = x.second;
            maxVal_h = x.first;
        }
    }

    for(i=0;i<n;i++)
    {
        if(D[i][0] == maxVal_h) um2[D[i][1]]--;
    }
    for(auto x: um2)
    {
        if(x.second > maxV)
        {
            maxV = x.second;
            maxVal_v = x.first;
        }
    }

    int ans = maxH + maxV;

    //for(i=0;i<n;i++)
    //{
        //if(D[i][0] == maxVal_h && D[i][1] == maxVal_v) ans--;
    //}
    return ans;*/
}

/*string string_solve(int n)
{

}*/

bool bool_solve(string s)
{
    int sum = 0;
    int i;
    for(i=0;i<s.length();i++) sum += (s[i] - '0');
    return !(sum % 9);
}

int32_t main()
{
    //code
	IOS;

    int t,n,m,a,b,x,y,i,j,z;
    //cin>>t;
    t = 1;
    while(t--)
    {
        int h,w;
        cin>>h>>w>>m;

        cout<<int_solve(m)<<endl;
    }

	return 0;
}


Measured memory_bytes: 35448