#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cmath>
using namespace std;

#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define EPS 1e-8
#define DEB 0

struct _Point{
  double x,y;
} point[110];

int edge[110][110];

double sqr(double x){
  return x*x;
}
bool isoverlap(int i, int j){
  return sqrt(sqr(point[i].x-point[j].x)+sqr(point[i].y-point[j].y))+EPS<=2.0;
}

int main(){
  int n;
  
  while(scanf("%d",&n),n){
    vector<vector<int> > vv;
    rep(i,110)rep(j,110)edge[i][j]=0;

    rep(i,n){
      scanf("%lf,%lf",&point[i].x,&point[i].y);
      rep(j,i){
	if( isoverlap(i,j) ){
	  edge[i][j] = edge[j][i] = 1;
	}
      }
    }
    rep(i,n){
      int m = vv.size();
      rep(j,m){
	int k;
	for(k=0; k<vv[j].size() && edge[i][vv[j][k]]>0; k++);
	if( k==vv[j].size() ){
	  vector<int> tmp = vv[j];
#if DEB
	  printf("i:%d  j:%d   sz:%d\n",i,j,vv[j].size()+1);
#endif
	  tmp.push_back(i);
	  vv.push_back(tmp);
	}
      }
      vector<int> tmp(1,i);
      vv.push_back(tmp);
    }
#if DEB
    rep(i,vv.size()){
      rep(j,vv[i].size()){
	printf("%d,",(int)vv[i][j]);
      }
      puts("");
    }
    puts("");
#endif
    int ans = 0;
    rep(i,vv.size()){
      ans = max(ans,(int)vv[i].size());
    }
    printf("%d\n",ans);
  }
  return 0;
}