import sys
from collections import Counter
 
 
def main():
    H, W, M = map(int, sys.stdin.readline().rstrip().split())
    Mh = [0] * H
    Mw = [0] * W
    B = []
    for i in range(M):
        h, w = map(int, sys.stdin.readline().rstrip().split())
        Mh[h - 1] += 1
        Mw[w - 1] += 1
        B.append((h - 1, w - 1))
 
    nh = max(Mh)
    nw = max(Mw)
 
    # 交差する場所に置かれた処理物があるか？
    lh = Counter(Mh)[nh]
    lw = Counter(Mw)[nw]
 
    out = 0
    for (h, w) in B:
        if Mh[h] == nh and Mw[w] == nw:
            out += 1
 
    if out == lh * lw:
        print(nh + nw - 1)
    else:
        print(nh + nw)
 
 
main() import sys sys from collections import Counter def main():
    H, W, M = map(int, sys.stdin.readline().rstrip().split())
    Mh = [0] * H
    Mw = [0] * W
    B = []
    for i in range(M):
        h, w = map(int, sys.stdin.readline().rstrip().split())
        Mh[h - 1] += 1
        Mw[w - 1] += 1
        B.append((h - 1, w - 1))
 
    nh = max(Mh)
    nw = max(Mw)
 
    # 交差する場所に置かれた処理物があるか？
    lh = Counter(Mh)[nh]
    lw = Counter(Mw)[nw]
 
    out = 0
    for (h, w) in B:
        if Mh[h] == nh and Mw[w] == nw:
            out += 1
 
    if out == lh * lw:
        print(nh + nw - 1)
    else:
        print(nh + nw)
 
  main H, W, M = map(int, sys.stdin.readline().rstrip().split()) H map(int, sys.stdin.readline().rstrip().split()) map int sys.stdin.readline().rstrip().split() sys.stdin.readline().rstrip().split sys.stdin.readline().rstrip() sys.stdin.readline().rstrip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline rstrip split W M Mh = [0] * H Mh [0] * H [0] 0 H Mw = [0] * W Mw [0] * W [0] 0 W B = [] B [] for i in range(M):
        h, w = map(int, sys.stdin.readline().rstrip().split())
        Mh[h - 1] += 1
        Mw[w - 1] += 1
        B.append((h - 1, w - 1))
 
     i range(M) range M h, w = map(int, sys.stdin.readline().rstrip().split()) h map(int, sys.stdin.readline().rstrip().split()) map int sys.stdin.readline().rstrip().split() sys.stdin.readline().rstrip().split sys.stdin.readline().rstrip() sys.stdin.readline().rstrip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline rstrip split w Mh[h - 1] += 1 Mh[h - 1] Mh h - 1 h 1 1 Mw[w - 1] += 1 Mw[w - 1] Mw w - 1 w 1 1 B.append((h - 1, w - 1)) B.append B append (h - 1, w - 1) h - 1 h 1 w - 1 w 1 nh = max(Mh) nh max(Mh) max Mh nw = max(Mw) nw max(Mw) max Mw lh = Counter(Mh)[nh] lh Counter(Mh)[nh] (Mh) Counter Mh nh lw = Counter(Mw)[nw] lw Counter(Mw)[nw] (Mw) Counter Mw nw out = 0 out 0 for (h, w) in B:
        if Mh[h] == nh and Mw[w] == nw:
            out += 1
 
     (h, w) h w B if Mh[h] == nh and Mw[w] == nw:
            out += 1
 
     Mh[h] == nh and Mw[w] == nw Mh[h] == nh Mh[h] Mh h nh Mw[w] == nw Mw[w] Mw w nw out += 1 out 1 if out == lh * lw:
        print(nh + nw - 1)
    else:
        print(nh + nw)
 
  out == lh * lw out lh * lw lh lw print(nh + nw - 1) print nh + nw - 1 nh + nw nh nw 1 print(nh + nw) print nh + nw nh nw main() main def main():
    H, W, M = map(int, sys.stdin.readline().rstrip().split())
    Mh = [0] * H
    Mw = [0] * W
    B = []
    for i in range(M):
        h, w = map(int, sys.stdin.readline().rstrip().split())
        Mh[h - 1] += 1
        Mw[w - 1] += 1
        B.append((h - 1, w - 1))
 
    nh = max(Mh)
    nw = max(Mw)
 
    # 交差する場所に置かれた処理物があるか？
    lh = Counter(Mh)[nh]
    lw = Counter(Mw)[nw]
 
    out = 0
    for (h, w) in B:
        if Mh[h] == nh and Mw[w] == nw:
            out += 1
 
    if out == lh * lw:
        print(nh + nw - 1)
    else:
        print(nh + nw)
 
  def main():
    H, W, M = map(int, sys.stdin.readline().rstrip().split())
    Mh = [0] * H
    Mw = [0] * W
    B = []
    for i in range(M):
        h, w = map(int, sys.stdin.readline().rstrip().split())
        Mh[h - 1] += 1
        Mw[w - 1] += 1
        B.append((h - 1, w - 1))
 
    nh = max(Mh)
    nw = max(Mw)
 
    # 交差する場所に置かれた処理物があるか？
    lh = Counter(Mh)[nh]
    lw = Counter(Mw)[nw]
 
    out = 0
    for (h, w) in B:
        if Mh[h] == nh and Mw[w] == nw:
            out += 1
 
    if out == lh * lw:
        print(nh + nw - 1)
    else:
        print(nh + nw)
 
  main
import sys
from collections import Counter
 
 
def main():
    H, W, M = map(int, sys.stdin.readline().rstrip().split())
    Mh = [0] * H
    Mw = [0] * W
    B = []
    for i in range(M):
        h, w = map(int, sys.stdin.readline().rstrip().split())
        Mh[h - 1] += 1
        Mw[w - 1] += 1
        B.append((h - 1, w - 1))
 
    nh = max(Mh)
    nw = max(Mw)
 
    # 交差する場所に置かれた処理物があるか？
    lh = Counter(Mh)[nh]
    lw = Counter(Mw)[nw]
 
    out = 0
    for (h, w) in B:
        if Mh[h] == nh and Mw[w] == nw:
            out += 1
 
    if out == lh * lw:
        print(nh + nw - 1)
    else:
        print(nh + nw)
 
 
main()