
import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.array;
import std.math;

int[] data;
int[] depth;

int[] get_utree() {return data;}

void init(int size) {
  data = new int[](size);
  depth = new int[](size);
  foreach (int i, int d; data) {
    data[i] = i;
  }
  foreach (int i, int d; depth) {
    depth[i] = 1;
  }
}

int find(int x) {
  if (data[x] == x) return x;
  else
    return data[x] = find(data[x]);
}

void unite(int x, int y) {
  int rootx = find(x), rooty = find(y);
  if (depth[rootx] > depth[rooty]) {
    data[rooty] = rootx;
  }
  else {
    data[rootx] = rooty;
    if (depth[rootx] == depth[rooty]) depth[rooty] += 1;
  }
}

int arr_max(int[] arr) {
  int [int] init;
  return reduce!((int[int] accum, int x) {
      if (accum.get(x, -1) == -1) {
        accum[x] = 1;
      }
      else {
        accum[x] += 1;
      }
      return accum;
    })(init, arr).values.reduce!(max);
}

double distance(double[] i, double[] j) {
  return sqrt((i[0] - j[0]).pow(2) +  (i[1] - j[1]).pow(2));
}

void main() {
  while(true) {
    int times = readln().chomp.to!(int);
    if (times == 0) break;
    double[][] circles = new double[][](times, 2);
    foreach(int t; 0..times) {
      circles[t] = readln().strip.chomp.split(",").map!(to!(double)).array;
    }
    init(100);
    foreach(int i, double[] x; circles) {
      foreach(int j, double[] y; circles) {
        double d = distance(x, y);
        if (d <= 2.0) {
          unite(i, j);
        }
      }
    }
    writeln(get_utree.arr_max);
  }
}