#include <bits/stdc++.h>
typedef struct {
  double x;
  double y;
} POINT;
int num;
int max;
void check_adj(char (*list)[100], int n, char *visit, int ans) {
  int i, j;
  if (visit[n] == 1) {
    return;
  }
  ans++;
  if (ans > max) {
    max = ans;
  }
  visit[n] = 1;
  for (i = 0; i < num; i++) {
    if (i == n) {
      continue;
    }
    if (list[n][i] == 1) {
      check_adj(list, i, visit, ans);
    }
  }
  return;
}
int main(void) {
  POINT seal[100];
  double dist;
  int i, j;
  char flag[100][100], visit[100];
  while (1) {
    scanf("%d", &num);
    if (num == 0) {
      break;
    }
    for (i = 0; i < num; i++) {
      scanf("%lf%*c%lf", &seal[i].x, &seal[i].y);
    }
    max = 1;
    memset(flag, (0), sizeof(flag));
    for (i = 0; i < num; i++) {
      for (j = 0; j < num; j++) {
        dist = ((seal[j].x - seal[i].x) * (seal[j].x - seal[i].x)) +
               ((seal[j].y - seal[i].y) * (seal[j].y - seal[i].y));
        if (0 <= dist && dist <= 4) {
          flag[i][j] = (1);
        }
      }
    }
    for (i = 0; i < num; i++) {
      memset(visit, 0, sizeof(visit));
      check_adj(flag, i, visit, 0);
    }
    printf("%d\n", max);
  }
  return (0);
}
