#include <bits/stdc++.h>
int n;
int flag[(200)][(200)];
int max_overlap;
void search(int *use, int start);
int main(void) {
  double circle[(200)][2];
  double d;
  int use[(200)];
  int i, j, k;
  int num[(200)];
  int cont_flag;
  while (1) {
    scanf("%d", &n);
    if (n == 0) {
      break;
    }
    for (i = 0; i < n; i++) {
      scanf("%lf,%lf", &circle[i][0], &circle[i][1]);
    }
    memset(flag, 0, sizeof(flag));
    for (i = 0; i < n; i++) {
      for (j = i; j < n; j++) {
        if (i == j) {
          flag[i][j] = 1;
        } else {
          d = (circle[i][0] - circle[j][0]) * (circle[i][0] - circle[j][0]) +
              (circle[i][1] - circle[j][1]) * (circle[i][1] - circle[j][1]);
          if (d <= 4.0) {
            flag[i][j] = flag[j][i] = 1;
          }
        }
      }
    }
    max_overlap = 1;
    do {
      for (i = 0; i < n; i++) {
        num[i] = 0;
        for (j = 0; j < n; j++) {
          num[i] += flag[i][j];
        }
      }
      cont_flag = 0;
      for (i = 0; i < n; i++) {
        if (num[i] == 2) {
          max_overlap = 2;
        }
        if (num[i] == 1 || num[i] == 2) {
          for (j = 0; j < n; j++) {
            flag[i][j] = flag[j][i] = 0;
          }
          cont_flag = 1;
        }
      }
    } while (cont_flag == 1);
    for (i = 0; i < n; i++) {
      memcpy(use, flag[i], sizeof(use));
      search(use, 0);
    }
    printf("%d\n", max_overlap);
  }
  return (0);
}
void search(int *use, int start) {
  int i, j;
  int use_next[(200)];
  int f;
  int overlap;
  f = 0;
  for (i = start; i < n; i++) {
    if (use[i] != 0) {
      f = 1;
      memcpy(use_next, use, sizeof(use_next));
      for (j = 0; j < n; j++) {
        if (use_next[j] != 0) {
          if (flag[i][j] == 0) {
            use_next[j] = 0;
          }
        }
      }
      search(use_next, start + 1);
    }
  }
  if (f == 0) {
    overlap = 0;
    for (i = 0; i < n; i++) {
      overlap += use[i];
    }
    if (max_overlap < overlap) {
      max_overlap = overlap;
    }
  }
}
