import itertools

x=[0.]*100;y=[0.]*100

for e in iter(input,'0'):

    a=0

    n=int(e)

    for i in range(n):x[i],y[i]=list(map(float,input().split(',')))

    for i,j in itertools.product(list(range(100)),list(range(100))):

            c=0

            for k in range(n):

                if pow(x[k]-(i/10),2)+pow(y[k]-(j/10),2)<=1.01:c+=1

            if c>a:a=c

    print(a)

def get_intersections(p0, p1):

    dist = abs(p0 - p1)



    if dist > 2:

        return []

    elif dist == 2:

        return [(p0 + p1) / 2]

    else:

        m = (p0 + p1) / 2

        v = m - p0

        w = complex(v.imag, -v.real)

        n = w / abs(w)

        d = abs(v)

        l = (1 - d ** 2)**.5



        inter0 = m + l * n

        inter1 = m - l * n

        return [inter0, inter1]



for e in iter(input, '0'):

    n = int(e)

    P = [complex(*list(map(float,input().split(','))))for _ in[0]*n]

    intersections = []

    for i in range(n):

        for j in range(i+1,n):

            intersections += get_intersections(P[i], P[j])

    c = 1

    for intersection in intersections:

        cnt = 0

        for p in P:

            if abs(intersection - p) <= 1.01:

                cnt += 1

        c=max(c,cnt)

    print(c)

import itertools

x = [0.0] * 100
y = [0.0] * 100
for e in iter(input, "0"):
    a = 0
    n = int(e)
    for i in range(n):
        x[i], y[i] = list(map(float, input().split(",")))
    for i, j in itertools.product(list(range(100)), list(range(100))):
        c = 0
        for k in range(n):
            if pow(x[k] - (i / 10), 2) + pow(y[k] - (j / 10), 2) <= 1.01:
                c += 1
        if c > a:
            a = c
    print(a)

def get_intersections(p0, p1):
    dist = abs(p0 - p1)
    if dist > 2:
        return []
    elif dist == 2:
        return [(p0 + p1) / 2]
    else:
        m = (p0 + p1) / 2
        v = m - p0
        w = complex(v.imag, -v.real)
        n = w / abs(w)
        d = abs(v)
        l = (1 - d**2) ** 0.5
        inter0 = m + l * n
        inter1 = m - l * n
        return [inter0, inter1]


for e in iter(input, "0"):
    n = int(e)
    P = [complex(*list(map(float, input().split(",")))) for _ in [0] * n]
    intersections = []
    for i in range(n):
        for j in range(i + 1, n):
            intersections += get_intersections(P[i], P[j])
    c = 1
    for intersection in intersections:
        cnt = 0
        for p in P:
            if abs(intersection - p) <= 1.01:
                cnt += 1
        c = max(c, cnt)
    print(c)

-import itertools +def get_intersections(p0, p1): +    dist = abs(p0 - p1) +    if dist > 2: +        return [] +    elif dist == 2: +        return [(p0 + p1) / 2] +    else: +        m = (p0 + p1) / 2 +        v = m - p0 +        w = complex(v.imag, -v.real) +        n = w / abs(w) +        d = abs(v) +        l = (1 - d**2) ** 0.5 +        inter0 = m + l * n +        inter1 = m - l * n +        return [inter0, inter1] -x = [0.0] * 100 -y = [0.0] * 100 + -    a = 0 +    P = [complex(*list(map(float, input().split(",")))) for _ in [0] * n] +    intersections = [] -        x[i], y[i] = list(map(float, input().split(","))) -    for i, j in itertools.product(list(range(100)), list(range(100))): -        c = 0 -        for k in range(n): -            if pow(x[k] - (i / 10), 2) + pow(y[k] - (j / 10), 2) <= 1.01: -                c += 1 -        if c > a: -            a = c -    print(a) +        for j in range(i + 1, n): +            intersections += get_intersections(P[i], P[j]) +    c = 1 +    for intersection in intersections: +        cnt = 0 +        for p in P: +            if abs(intersection - p) <= 1.01: +                cnt += 1 +        c = max(c, cnt) +    print(c)