#include <bits/stdc++.h>
using namespace std;
typedef struct {
  int index;
  int degree;
} SORTDATA;
bool operator<(const SORTDATA& a, const SORTDATA& b) {
  return (a.degree > b.degree);
}
int n;
char G[100][100];
vector<char> G_list[100];
int degree[100];
int ans;
int check(char use[], int depth) {
  char next[100];
  int next_count;
  char real_next[100];
  int i, j;
  if (depth > ans) {
    ans = depth;
  }
  memset(next, 0, sizeof(next));
  next_count = 0;
  for (i = 0; i < depth; i++) {
    for (j = 0; j < G_list[i].size(); j++) {
      next[G_list[i][j]]++;
      if (next[G_list[i][j]] == depth) {
        real_next[next_count++] = G_list[i][j];
      }
    }
  }
  if (next_count == 0) {
    return (0);
  }
  for (i = 0; i < next_count; i++) {
    if (degree[real_next[i]] > ans - 1) {
      use[depth] = real_next[i];
      check(use, depth + 1);
    }
  }
  return (0);
}
int main(void) {
  double x[100], y[100];
  while (1) {
    scanf("%d", &n);
    if (n == 0) {
      break;
    }
    for (int i = 0; i < n; i++) {
      G_list[i].clear();
    }
    memset(G, 0, sizeof(G));
    for (int i = 0; i < n; i++) {
      scanf("%lf,%lf", &x[i], &y[i]);
    }
    for (int i = 0; i < n; i++) {
      for (int j = i + 1; j < n; j++) {
        if (((x[i] - x[j]) * (x[i] - x[j])) + ((y[i] - y[j]) * (y[i] - y[j])) <=
            4.0) {
          G[i][j] = G[j][i] = 1;
          G_list[i].push_back(j);
          G_list[j].push_back(i);
        }
      }
    }
    SORTDATA sort_data[100];
    for (int i = 0; i < n; i++) {
      degree[i] = 0;
      for (int j = 0; j < n; j++) {
        degree[i] += G[i][j];
      }
      sort_data[i].degree = degree[i];
      sort_data[i].index = i + 1;
    }
    sort(sort_data, sort_data + n);
    char use[100];
    memset(use, 0, sizeof(use));
    ans = 1;
    for (int i = 0; i < n; i++) {
      if (sort_data[i].degree > ans - 1) {
        use[0] = sort_data[i].index;
        check(use, 1);
      }
    }
    printf("%d\n", ans);
  }
  return (0);
}
