import math, itertools
while True:
    n=input()
    if n==0:break
    L=[map(float,raw_input().split(",")) for i in range(n)]
    S=[set() for i in range(n)]
    for i in range(n):
        for j in range(n):
            d=math.sqrt(pow(L[i][0]-L[j][0],2)+pow(L[i][1]-L[j][1],2))
            if i<>j and d<=2:
                S[i].add(j)
    maxInt=0
    for i in range(n):
        cnt=1
        for j,k in itertools.combinations(S[i],2):
            if j in S[k] and k in S[j]:
                cnt+=1
	maxInt=max(maxInt,cnt)
    A=reduce(lambda x,y:x.union(y),S)
    if A==set():
        print 1
    else:
        print max(maxInt,2)