import numpy as np
from functools import *
import sys
sys.setrecursionlimit(100000)
input = sys.stdin.readline


def array(size, init=0):
    return [[init for j in range(size[1])] for i in range(size[0])]


def acinput():
    return list(map(int, input().split(" ")))


def II():
    return int(input())


directions = np.array([[1, 0], [0, 1], [-1, 0], [0, -1]])
directions = list(map(np.array, directions))

mod = 10**9+7


def factorial(n):
    fact = 1
    for integer in range(1, n + 1):
        fact *= integer
    return fact


def permutate(x, A):
    n = len(x)
    res = [-1]*n
    for i in range(n):

        res[i] = x[A[i]]
    return res


def generate_bin(digit):
    for b in range(2**digit):
        b = bin(b)
        tmp = b[2:].zfill(digit)
        yield list(map(int, tmp))
        # b=list(map(int,list(b[2:].zfill(digit))))
        # yield b


def search(x, count):
    #print("top", x, count)

    for d in directions:
        nx = d+x
        # print(nx)
        if np.all(0 <= nx) and np.all(nx < (H, W)):
            if field[nx[0]][nx[1]] == "E":
                count += 1
                field[nx[0]][nx[1]] = "V"
                count = serch(nx, count)
                continue
            if field[nx[0]][nx[1]] == "#":
                field[nx[0]][nx[1]] = "V"
                count = serch(nx, count)

    return count


H, W, M = acinput()

Bh = [[0, i] for i in range(H+1)]
Bw = [[0, i] for i in range(W+1)]
B = {}
for i in range(M):
    h, w = acinput()
    Bh[h][0] += 1
    Bw[w][0] += 1
    B[(h, w)] = 1

Bh = sorted(Bh,  reverse=True)
Bw = sorted(Bw,  reverse=True)

Hidx = []
Widx = []
k = 0
while True:
    Hidx.append(k)
    if Bh[k][0] > Bh[k+1][0]:
        break
    k += 1

k = 0
while True:
    Widx.append(k)
    if Bw[k][0] > Bw[k+1][0]:
        break
    k += 1

for hi in Hidx:
    h = Bh[k][1]
    for wi in Widx:
        w = Bw[k][1]
        if not((h, w) in B):
            res = Bh[h][0]+Bw[w][0]
            print(res)
            sys.exit()


print(Bh[0][0]+Bw[0][0]-1)


### FIXED CODE ###


#import numpy as np
#from functools import *
import sys
sys.setrecursionlimit(100000)
input = sys.stdin.readline


def array(size, init=0):
    return [[init for j in range(size[1])] for i in range(size[0])]


def acinput():
    return list(map(int, input().split(" ")))


def II():
    return int(input())


def factorial(n):
    fact = 1
    for integer in range(1, n + 1):
        fact *= integer
    return fact


def permutate(x, A):
    n = len(x)
    res = [-1]*n
    for i in range(n):

        res[i] = x[A[i]]
    return res


def generate_bin(digit):
    for b in range(2**digit):
        b = bin(b)
        tmp = b[2:].zfill(digit)
        yield list(map(int, tmp))
        # b=list(map(int,list(b[2:].zfill(digit))))
        # yield b


H, W, M = acinput()

Bh = [[0, i] for i in range(H+1)]
Bw = [[0, i] for i in range(W+1)]
B = {}
for i in range(M):
    h, w = acinput()
    Bh[h][0] += 1
    Bw[w][0] += 1
    B[(h, w)] = 1

Bh = sorted(Bh,  reverse=True)
Bw = sorted(Bw,  reverse=True)

Hidx = []
Widx = []
k = 0
while True:
    Hidx.append(k)
    if Bh[k][0] > Bh[k+1][0]:
        break
    k += 1
    if k >= len(Bw):
        break

k = 0
while True:
    Widx.append(k)
    if Bw[k][0] > Bw[k+1][0]:
        break
    k += 1
    if k >= len(Bw):
        break

""" print(Bh)
print(Hidx)
print(Bw)
print(Widx) """

for hi in Hidx:
    h = Bh[hi][1]
    for wi in Widx:
        w = Bw[wi][1]
        if not((h, w) in B):
            res = Bh[0][0]+Bw[0][0]
            print(res)
            #print(h, w)
            sys.exit()


print(Bh[0][0]+Bw[0][0]-1)

# print("cross")

'''
h=0
w=0
while True:
    if not((h, w) in B) or Bh[h] > Bh[h + 1] or Bw[w] > Bw[w + 1]:
        res=Bh[h]+Bw[w]+a
        break

    res=Bh[h]+Bw[w]+1
    
'''