def ovwp?(g0, g1, mtx)
  g0.each do |i|
    g1.each do |j|
      return false if ! mtx[i][j]
    end
  end

  return true
end

### main

while true
  n = gets.chomp.to_i
  break if n == 0

  cnts = []
  n.times do
    x, y = gets.chomp.split(",").map{|s| s.to_f}
    cnts.push [x, y]
  end

  owmtx = (0...n).map{|i| (0...n).map{|j| i == j}}
  grps  = []

  for i in (0...cnts.length)
    c0 = cnts[i]
    for j in ((i + 1)...cnts.length)
      c1 = cnts[j]
      if (c1[0] - c0[0]) ** 2 + (c1[1] - c0[1]) ** 2 <= 4.0
        owmtx[i][j] = owmtx[j][i] = true
        grps.push [i, j]
      end
    end
  end

  max_g = 1

  for i in (0...grps.length)
    g0 = grps[i]

    for j in ((i + 1)...grps.length)
      g1 = grps[j]
      if ovwp?(g0, g1, owmtx)
        g0 = (g0 + g1).uniq
      end
    end

    max_g = g0.length if max_g < g0.length
  end

  puts max_g
end