import itertools
def isOverlapped(x1,y1,x2,y2,r1,r2):
    return ((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))**0.5<=r1+r2
while True:
    n=input()
    if n==0:
        break
    li=[]
    for i in xrange(n):
        li.append(map(float,raw_input().split(",")))
    ov=[1]*n
    for i,j in itertools.combinations(xrange(n),2):
        if isOverlapped(li[i][0],li[i][1],li[j][1],li[j][1],1,1):
            ov[i]+=1
            ov[j]+=1
    print max(ov)