import collections
import sys
def input() : return sys.stdin.readline().strip()
h,w,m = map(int,input().split())
X = []
Y = []
for _ in range(m):
    x,y = map(int,input().split())
    X.append(x)
    Y.append(y)

most_common_x = collections.Counter(X).most_common()
most_common_x_index = most_common_x[0][0]
most_common_x_count = most_common_x[0][1]
most_common_y = collections.Counter(Y).most_common()
most_common_y_index = most_common_y[0][0]
most_common_y_count = most_common_y[0][1]

otherwisey = []
otherwisex = []
for i in range(m):
    if X[i] != most_common_x_index:
        otherwisey.append(Y[i])
    if Y[i] != most_common_y_index:
        otherwisex.append(X[i])

most_common_y = collections.Counter(otherwisey).most_common()
if len(most_common_y)!= 0:
    ansx = most_common_y[0][1] + most_common_x_count
else:
    ansx = most_common_x_count

most_common_x = collections.Counter(otherwisex).most_common()
if len(most_common_x)!= 0:
    ansy = most_common_x[0][1] + most_common_y_count
else:
    ansy = most_common_y_count

print(max(ansx,ansy)) import collections collections import sys sys def input() : return sys.stdin.readline().strip() input h,w,m = map(int,input().split()) h map(int,input().split()) map int input().split() ().split () input split w m X = [] X [] Y = [] Y [] for _ in range(m):
    x,y = map(int,input().split())
    X.append(x)
    Y.append(y) _ range(m) range m x,y = map(int,input().split()) x map(int,input().split()) map int input().split() ().split () input split y X.append(x) X.append X append x Y.append(y) Y.append Y append y most_common_x = collections.Counter(X).most_common() most_common_x collections.Counter(X).most_common() collections.Counter(X).most_common collections.Counter(X) collections.Counter collections Counter X most_common most_common_x_index = most_common_x[0][0] most_common_x_index most_common_x[0][0] [0] most_common_x 0 0 most_common_x_count = most_common_x[0][1] most_common_x_count most_common_x[0][1] [0] most_common_x 0 1 most_common_y = collections.Counter(Y).most_common() most_common_y collections.Counter(Y).most_common() collections.Counter(Y).most_common collections.Counter(Y) collections.Counter collections Counter Y most_common most_common_y_index = most_common_y[0][0] most_common_y_index most_common_y[0][0] [0] most_common_y 0 0 most_common_y_count = most_common_y[0][1] most_common_y_count most_common_y[0][1] [0] most_common_y 0 1 otherwisey = [] otherwisey [] otherwisex = [] otherwisex [] for i in range(m):
    if X[i] != most_common_x_index:
        otherwisey.append(Y[i])
    if Y[i] != most_common_y_index:
        otherwisex.append(X[i]) i range(m) range m if X[i] != most_common_x_index:
        otherwisey.append(Y[i])
     X[i] != most_common_x_index X[i] X i most_common_x_index otherwisey.append(Y[i]) otherwisey.append otherwisey append Y[i] Y i if Y[i] != most_common_y_index:
        otherwisex.append(X[i]) Y[i] != most_common_y_index Y[i] Y i most_common_y_index otherwisex.append(X[i]) otherwisex.append otherwisex append X[i] X i most_common_y = collections.Counter(otherwisey).most_common() most_common_y collections.Counter(otherwisey).most_common() collections.Counter(otherwisey).most_common collections.Counter(otherwisey) collections.Counter collections Counter otherwisey most_common if len(most_common_y)!= 0:
    ansx = most_common_y[0][1] + most_common_x_count
else:
    ansx = most_common_x_count len(most_common_y)!= 0 len(most_common_y) len most_common_y 0 ansx = most_common_y[0][1] + most_common_x_count ansx most_common_y[0][1] + most_common_x_count most_common_y[0][1] [0] most_common_y 0 1 most_common_x_count ansx = most_common_x_count ansx most_common_x_count most_common_x = collections.Counter(otherwisex).most_common() most_common_x collections.Counter(otherwisex).most_common() collections.Counter(otherwisex).most_common collections.Counter(otherwisex) collections.Counter collections Counter otherwisex most_common if len(most_common_x)!= 0:
    ansy = most_common_x[0][1] + most_common_y_count
else:
    ansy = most_common_y_count len(most_common_x)!= 0 len(most_common_x) len most_common_x 0 ansy = most_common_x[0][1] + most_common_y_count ansy most_common_x[0][1] + most_common_y_count most_common_x[0][1] [0] most_common_x 0 1 most_common_y_count ansy = most_common_y_count ansy most_common_y_count print(max(ansx,ansy)) print max(ansx,ansy) max ansx ansy ansy = most_common_x[0][1] + most_common_y_count most_common_x[0][1] + most_common_y_count ansy X = [] [] X most_common_x_count = most_common_x[0][1] most_common_x[0][1] most_common_x_count ansx = most_common_y[0][1] + most_common_x_count most_common_y[0][1] + most_common_x_count ansx most_common_y_count = most_common_y[0][1] most_common_y[0][1] most_common_y_count otherwisey = [] [] otherwisey most_common_y = collections.Counter(otherwisey).most_common() collections.Counter(otherwisey).most_common() most_common_y most_common_x = collections.Counter(otherwisex).most_common() collections.Counter(otherwisex).most_common() most_common_x Y = [] [] Y y = map(int,input().split()) map(int,input().split()) y most_common_x = collections.Counter(X).most_common() collections.Counter(X).most_common() most_common_x w,m = map(int,input().split()) map(int,input().split()) w m = map(int,input().split()) map(int,input().split()) m ansy = most_common_y_count most_common_y_count ansy def input() : return sys.stdin.readline().strip() def input() : return sys.stdin.readline().strip() input ansx = most_common_x_count most_common_x_count ansx x,y = map(int,input().split()) map(int,input().split()) x most_common_x_index = most_common_x[0][0] most_common_x[0][0] most_common_x_index most_common_y = collections.Counter(Y).most_common() collections.Counter(Y).most_common() most_common_y otherwisex = [] [] otherwisex h,w,m = map(int,input().split()) map(int,input().split()) h most_common_y_index = most_common_y[0][0] most_common_y[0][0] most_common_y_index
import collections
import sys
def input() : return sys.stdin.readline().strip()
h,w,m = map(int,input().split())
X = []
Y = []
for _ in range(m):
    x,y = map(int,input().split())
    X.append(x)
    Y.append(y)

most_common_x = collections.Counter(X).most_common()
most_common_x_index = most_common_x[0][0]
most_common_x_count = most_common_x[0][1]
most_common_y = collections.Counter(Y).most_common()
most_common_y_index = most_common_y[0][0]
most_common_y_count = most_common_y[0][1]

otherwisey = []
otherwisex = []
for i in range(m):
    if X[i] != most_common_x_index:
        otherwisey.append(Y[i])
    if Y[i] != most_common_y_index:
        otherwisex.append(X[i])

most_common_y = collections.Counter(otherwisey).most_common()
if len(most_common_y)!= 0:
    ansx = most_common_y[0][1] + most_common_x_count
else:
    ansx = most_common_x_count

most_common_x = collections.Counter(otherwisex).most_common()
if len(most_common_x)!= 0:
    ansy = most_common_x[0][1] + most_common_y_count
else:
    ansy = most_common_y_count

print(max(ansx,ansy))