#include <iostream>
#include <stack>
#include <algorithm>
#include <cstdio>
#include <sstream>
#include <string>
#include <vector>
#include <cmath>

#define rep(x,to) for(int x=0;x<to;x++)
#define rep2(x,from,to) for(int x=from;x<to;x++)

using namespace std;


double dist(double x1,double y1,double x2,double y2){
	return ((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));
}



int main(void){

double tx[101],ty[101];
int n;
char k;
	
	while(cin >> n){
		if(n ==0 || cin.eof()) break;
		rep(i,n) cin >> tx[i] >> k >> ty[i];
		bool ds[101][101];
		int cnt[101]={0};
		rep(i,n) rep2(j,i+1,n)
			if( dist(tx[i],ty[i],tx[j],ty[j]) <= 4.0){
				ds[i][j]=true;
				cnt[i]++; cnt[j]++;
			}
			else        ds[i][j]=false;
		
		
		int mx=0;
		rep(i,n) mx = max(mx, cnt[i]);
		int cmx=0;
		if(mx>0){
			cmx=1;
			rep(k,n){
				vector<int>z;
				int ct2=0;
				if(cnt[k]<=cmx) continue;
				rep(i,n) if(ds[k][i] && i != k) z.push_back(i);
				rep(i,n) if(ds[i][k] && i != k) z.push_back(i);
				sort(z.begin(), z.end());
				z.erase(unique(z.begin(), z.end()),z.end());
				int ct1=z.size();
//				rep(i,ct1) printf("z%d:%d, ",i,z[i]);
				rep(i,ct1) rep2(j,i+1,ct1) if(ds[z[i]][z[j]]) ct2++;
				if( cnt[k]+ct2 >= cnt[k]*(cnt[k]+1)/2) cmx=cnt[k];
				else if( cnt[k]+ct2 >= cnt[k]*(cnt[k]-1)/2 && cnt[k] - 1 > cmx) cmk = cnt[k] -1; 
			}
		}
		
		cout << cmx+1 <<endl;
//		rep(i,n) rep2(j,i+1,n) if(ds[i][j])printf("%d:%d , ",i+1,j+1); printf("\n");
//		rep(i,n) printf("%d:%d, ",i+1,cnt[i]);
	}
	return 0;
	
}