h, w, k = map(int, input().split())

r_n = [0] * h
c_n = [0] * w
bomb_table = set()
for i in range(k):
    hi, wi = map(int, input().split())
    hi -= 1
    wi -= 1
    r_n[hi] += 1
    c_n[wi] += 1
    bomb_table.add((hi, wi))

max_x = max(c_n)
max_y = max(r_n)
ans = max_x + max_y

max_x_table = set()
max_y_table = set()

for i in range(h):
    if r_n[i] == max_y:
        max_y_table.add(i)

for i in range(w):
    if c_n[i] == max_x:
        max_x_table.add(i)

for i in max_y_table:
    for j in max_x_table:
        if (i, j) not in bomb_table:
            print(ans)
            exit(0)
print(ans - 1) h, w, k = map(int, input().split()) h map(int, input().split()) map int input().split() ().split () input split w k r_n = [0] * h r_n [0] * h [0] 0 h c_n = [0] * w c_n [0] * w [0] 0 w bomb_table = set() bomb_table set() set for i in range(k):
    hi, wi = map(int, input().split())
    hi -= 1
    wi -= 1
    r_n[hi] += 1
    c_n[wi] += 1
    bomb_table.add((hi, wi)) i range(k) range k hi, wi = map(int, input().split()) hi map(int, input().split()) map int input().split() ().split () input split wi hi -= 1 hi 1 wi -= 1 wi 1 r_n[hi] += 1 r_n[hi] r_n hi 1 c_n[wi] += 1 c_n[wi] c_n wi 1 bomb_table.add((hi, wi)) bomb_table.add bomb_table add (hi, wi) hi wi max_x = max(c_n) max_x max(c_n) max c_n max_y = max(r_n) max_y max(r_n) max r_n ans = max_x + max_y ans max_x + max_y max_x max_y max_x_table = set() max_x_table set() set max_y_table = set() max_y_table set() set for i in range(h):
    if r_n[i] == max_y:
        max_y_table.add(i) i range(h) range h if r_n[i] == max_y:
        max_y_table.add(i) r_n[i] == max_y r_n[i] r_n i max_y max_y_table.add(i) max_y_table.add max_y_table add i for i in range(w):
    if c_n[i] == max_x:
        max_x_table.add(i) i range(w) range w if c_n[i] == max_x:
        max_x_table.add(i) c_n[i] == max_x c_n[i] c_n i max_x max_x_table.add(i) max_x_table.add max_x_table add i for i in max_y_table:
    for j in max_x_table:
        if (i, j) not in bomb_table:
            print(ans)
            exit(0) i max_y_table for j in max_x_table:
        if (i, j) not in bomb_table:
            print(ans)
            exit(0) j max_x_table if (i, j) not in bomb_table:
            print(ans)
            exit(0) (i, j) not in bomb_table (i, j) i j bomb_table print(ans) print ans exit(0) exit 0 print(ans - 1) print ans - 1 ans 1 k = map(int, input().split()) map(int, input().split()) k ans = max_x + max_y max_x + max_y ans max_x = max(c_n) max(c_n) max_x hi -= 1 1 hi wi -= 1 1 wi max_x_table = set() set() max_x_table r_n = [0] * h [0] * h r_n wi = map(int, input().split()) map(int, input().split()) wi max_y_table = set() set() max_y_table w, k = map(int, input().split()) map(int, input().split()) w c_n = [0] * w [0] * w c_n hi, wi = map(int, input().split()) map(int, input().split()) hi bomb_table = set() set() bomb_table h, w, k = map(int, input().split()) map(int, input().split()) h max_y = max(r_n) max(r_n) max_y
h, w, k = map(int, input().split())

r_n = [0] * h
c_n = [0] * w
bomb_table = set()
for i in range(k):
    hi, wi = map(int, input().split())
    hi -= 1
    wi -= 1
    r_n[hi] += 1
    c_n[wi] += 1
    bomb_table.add((hi, wi))

max_x = max(c_n)
max_y = max(r_n)
ans = max_x + max_y

max_x_table = set()
max_y_table = set()

for i in range(h):
    if r_n[i] == max_y:
        max_y_table.add(i)

for i in range(w):
    if c_n[i] == max_x:
        max_x_table.add(i)

for i in max_y_table:
    for j in max_x_table:
        if (i, j) not in bomb_table:
            print(ans)
            exit(0)
print(ans - 1)
