__author__ = 'Zlobober'
n, m, q = map(int, raw_input().split())
F = [list(map(int, raw_input().split())) for i in range(n)]
def calc(i):
ans = 0
l = -1
for j in range(m):
if F[i][j] == 0:
l = j
else:
ans = max(ans, j - l)
return ans
row = list(map(calc, range(n)))
for i in range(q):
y, x = map(int, raw_input().split())
y -= 1
x -= 1
F[y][x] = 1 - F[y][x]
row[y] = calc(y)
print max(row)
X19hdXRob3JfXyA9ICdabG9ib2JlcicKbiwgbSwgcSA9IG1hcChpbnQsIHJhd19pbnB1dCgpLnNwbGl0KCkpCkYgPSBbbGlzdChtYXAoaW50LCByYXdfaW5wdXQoKS5zcGxpdCgpKSkgZm9yIGkgaW4gcmFuZ2UobildCgpkZWYgY2FsYyhpKToKICAgIGFucyA9IDAKICAgIGwgPSAtMQogICAgZm9yIGogaW4gcmFuZ2UobSk6CiAgICAgICAgaWYgRltpXVtqXSA9PSAwOgogICAgICAgICAgICBsID0gagogICAgICAgIGVsc2U6CiAgICAgICAgICAgIGFucyA9IG1heChhbnMsIGogLSBsKQogICAgcmV0dXJuIGFucwoKcm93ID0gbGlzdChtYXAoY2FsYywgcmFuZ2UobikpKQoKZm9yIGkgaW4gcmFuZ2UocSk6CiAgICB5LCB4ID0gbWFwKGludCwgcmF3X2lucHV0KCkuc3BsaXQoKSkKICAgIHkgLT0gMQogICAgeCAtPSAxCiAgICBGW3ldW3hdID0gMSAtIEZbeV1beF0KICAgIHJvd1t5XSA9IGNhbGMoeSkKICAgIHByaW50IG1heChyb3cpCgo=