import java.util

import scala.collection.mutable

object Main extends App {
  type Radian = Double
  import scala.math.{sin, cos, sqrt, Pi, acos}
  import scala.io.StdIn.{readLine}
  import Main.Angle._
  loop(readLine().toInt)
  def loop(n:Int):Unit = {
    if (n == 0) return
    val circles = Array.tabulate(n) { _ ⇒
      val Array(x, y) = readLine().split(',').map(_.toDouble)
      Circle(Coordinate(x, y))
    }
    println(circles.map { circle ⇒
      val flag = Flag.Empty
      val stack = mutable.Stack[EndPoint]()
      var overlapped: Int = 0
      for (i ← 0 until circles.size) {
        if (circle == circles(i)) {
          overlapped += 1
        } else {
          circle.CrossPoint(circles(i)) match {
            case Some((begin, end)) ⇒
              stack.push(EndPoint(Begin, i, begin), EndPoint(End, i, end))
            case _ ⇒
          }
        }
      }
      var max = 0
      var current = overlapped
      stack.sorted.foreach {
        case EndPoint(Begin, id, _) ⇒
          flag.SetFlag(id)
          current += 1
        case EndPoint(_, id, _) if flag.IsSet(id) ⇒
          flag.UnsetFlag(id)
          if (max < current) max = current
          current -= 1
        case EndPoint(_, _, _) ⇒
          if (max < current) max = current
          max += 1
      }
      if (max < current) max = current
      max
    }.max)
    loop(readLine().toInt)
  }
  sealed trait EndType
  object Begin extends EndType{
    override def toString: String = "Begin"
  }
  object End extends EndType{
    override def toString: String = "End"
  }
  case class EndPoint(endType: EndType, id:Int, angle: Angle) extends Ordered[EndPoint] {
    override def compare(that: EndPoint): Int = if (angle == that.angle) (endType, that.endType) match{
      case (Begin, End) ⇒ -1
      case (End, Begin) ⇒ 1
      case _ ⇒ 0
    } else angle.compareTo(that.angle)
  }
  case class Coordinate(x:Double, y:Double){
    def +(other:Coordinate):Coordinate = Coordinate(x + other.x, y + other.y)
    def -(other:Coordinate):Coordinate = Coordinate(x - other.x, y - other.y)
    def Length:Double = sqrt(x * x + y * y)

    override def toString: String = s"($x, $y)"
    override def equals(obj: scala.Any): Boolean = {
      obj match{
        case Coordinate(a, b) ⇒ x == a && y == b
        case _ ⇒ false
      }
    }
  }
  implicit class ImplicitCoordinateManipulator(val coordinate: Coordinate){
    def Fmap(transformer:Double => Double):Coordinate = Coordinate(transformer(coordinate.x), transformer(coordinate.y))
    def *(other:Int):Coordinate = Coordinate(coordinate.x * other, coordinate.y * other)
    def /(other:Int):Coordinate = Coordinate(coordinate.x / other, coordinate.y / other)
  }
  class Angle private (val Sin:Double, val Cos:Double) extends Ordered[Angle]{
    def +(other:Angle):Angle = new Angle(Sin * other.Cos + Cos * other.Sin, Cos * other.Cos - Sin * other.Sin)
    def -(other:Angle):Angle = new Angle(Sin * other.Cos - Cos * other.Sin, Cos * other.Cos + Sin * other.Sin)
    private def ToRadian:Radian = if (Sin >= 0) acos(Cos) else 2 * Pi - acos(Cos)
    override def compare(that: Angle): Int = ToRadian.compareTo(that.ToRadian)

    override def toString: String = s"${ToRadian * 180 / Pi}"
  }
  object Angle{
    implicit class ImplicitCoordinateAngleConverter(val coordinate:Coordinate){
      def ToAngle:Angle = new Angle(coordinate.y / coordinate.Length, coordinate.x / coordinate.Length)
    }
    implicit class ImplicitAngleCoordinateConverter(val angle: Angle){
      def ToCoordinate:Coordinate = Coordinate(angle.Cos, angle.Sin)
    }
    implicit class ImplicitRadianToAngleConverter(val rad:Radian){
      def ToAngle:Angle = new Angle(sin(rad), cos(rad))
    }
  }
  case class Circle(center:Coordinate){
    def CrossPoint(other:Circle):Option[(Angle, Angle)] = {
      (center - other.center).Length match{
        case len if len > 2 => None
        case len =>
          val angle = (other.center - center).ToAngle
          val diff = acos(len / 2).ToAngle
          val posA = angle - diff
          val posB = angle + diff
          Some((posA, posB))
      }
    }
  }
  class Flag private (private var first:Int = 0, private var second:Int = 0, private var third:Int = 0, private var forth:Int = 0){
    def SetFlag(n:Int):Unit = {
      n match{
        case _ if n > 96 ⇒ forth |= 1 << (n - 96)
        case _ if n > 64 ⇒ third |= 1 << (n - 64)
        case _ if n > 32 ⇒ second |= 1 << (n - 32)
        case _ ⇒ first |= 1 << n
      }
    }
    def IsSet(n:Int):Boolean = {
      n match{
        case _ if n > 96 ⇒ (forth & (1 << (n - 96))) != 0
        case _ if n > 64 ⇒ (third & (1 << (n - 64))) != 0
        case _ if n > 32 ⇒ (second & (1 << (n - 32))) != 0
        case _ ⇒ (first & (1 << n)) != 0
      }
    }
    def UnsetFlag(n:Int):Unit = {
      n match{
        case _ if n > 96 ⇒ forth &= ~(1 << (n - 96))
        case _ if n > 64 ⇒ third &= ~(1 << (n - 64))
        case _ if n > 32 ⇒ second &= ~(1 << (n - 32))
        case _ ⇒ first &= ~(1 << n)
      }
    }
  }
  object Flag{
    def Empty= new Flag()
  }
}

