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

namespace AOJ2
{
    class Program
    {
        class Point
        {
            public decimal X;
            public decimal Y;

            public Point(decimal x, decimal y)
            {
                X = x;
                Y = y;
            }

        }

        static void Main(string[] args)
        {
            List<int> resultList = new List<int>();

            while (true)
            {
                string input = Console.ReadLine();
                if (input == "0")
                {
                    break;
                }
    
                List<Point> sealList = new List<Point>();
                int num = int.Parse(input);

                for (int k = 0; k < num; k++)
                {
                    string s = Console.ReadLine();

                    string[] inputArray = s.Split(',');
                    Point point = new Point(decimal.Parse(inputArray[0]), decimal.Parse(inputArray[1]));
                    sealList.Add(point);
                }

                int max = 0;
                int[] countArray = new int[num];

                for (int i = 0; i < num; i++)
                {
                    for (int j = i + 1; j < num; j++)
                    {
                        if (Judge(sealList[i], sealList[j]))
                        {
                            countArray[i]++;
                            countArray[j]++;
                            if (countArray[i] > max)
                            {
                                max = countArray[i];
                            }
                            if (countArray[j] > max)
                            {
                                max = countArray[j];
                            }
                        }
                    }
                }

                resultList.Add(max + 1);
            }


            foreach (int a in resultList)
            {
                Console.WriteLine(a);
            }
            

        }

        static bool Judge(Point A, Point B)
        {
            
            if (Math.Sqrt(Math.Pow((double)(A.X - B.X), 2) + Math.Pow((double)(A.Y - B.Y), 2)) <= 2)
            {
                return true;
            }
            else
            {
                return false;
            }


        }
        
    }
}