using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace P0090_OverlapsofSeals
{
    class Program
    {
        static void Main(string[] args)
        {
            int cntLine;

            var lines = new List<List<string[]>>();

            do
            {
                cntLine = int.Parse(Console.ReadLine());

                var line = new List<string[]>();

                for (int i = 1; i <= cntLine; i++)
                {
                    line.Add(Console.ReadLine().Split(','));
                }

                lines.Add(line);

            }
            while (cntLine != 0);


            foreach (List<string[]> line in lines)
            {

                if (line.Count == 0)
                {
                    break;
                }

                var map = new Boolean[line.Count, line.Count];

                for (int i = 0; i < line.Count; i++ ) 
                {
                    var pointA = line[i];

                    for (int j = i+1; j < line.Count; j++)
                    {
                        var pointB = line[j];

                        double l = Math.Sqrt(
                            Math.Pow(double.Parse(pointB[0]) - double.Parse(pointA[0]), 2) + 
                            Math.Pow(double.Parse(pointB[1]) - double.Parse(pointA[1]), 2));

                        if(l <= 2)
                        {
                            map[i, j] = true;
                            map[j, i] = true;
                        }

                        

                    }

                }

                int max = 1;

                for (int i = 0; i < line.Count; i++)
                {
                    int cnt = 1;

                    for (int j = 0; j < line.Count; j++)
                    {
                        if(map[i,j])
                        {
                            cnt++;
                        }
                    }

                    if(max < cnt)
                    {
                        max = cnt;
                    }

                    //Console.WriteLine("{0} = {1}", i, cnt);

                }
                Console.WriteLine(max);

            }

        }
    }
}