#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<cctype>
#include<complex>
#include<iostream>
#include<sstream>
#include<algorithm>
#include<functional>
#include<utility>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>

using namespace std;
const int dx[] = {1,0,-1,0},dy[] = {0,1,0,-1};
#define INF 1e+9
#define EPS 1e-9
#define rep(i,j) for(int i = 0; i < (j); i++)
#define reps(i,j,k) for(int i = j; i < (k); i++)
typedef long long ll;

int n;
int ans;
double x[128],y[128];
bool D[128][128];

void init(){
	ans = 1;
	fill(x,x+n,0);
	fill(y,y+n,0);
	memset(D,false,sizeof(D));
}
double dis(int a,int b){
	double ans = 0;
	ans = sqrt((x[a]-x[b])*(x[a]-x[b])+(y[a]-y[b])*(y[a]-y[b]));
	return ans;
}
void mkpair(){
	rep(i,n){
		reps(j,i+1,n){
			if(dis(i,j) <= 2.0){
				D[i][j] = D[j][i] = true;
			}
		}
	}
}
int main(){
	while(scanf("%d",&n),n){
		init();
		rep(i,n){
			scanf("%lf,%lf",&x[i],&y[i]);
		}
		mkpair();
		int cnt = 0;
		vector<int> f;
		vector<int> s;
		rep(i,n){
			cnt = 0;
			reps(j,i+1,n){
				if(D[i][j]){
					++cnt;
					f.push_back(i);
					s.push_back(j);
				}
			}
		}
		queue<int> Q;
		vector<int> vi;
		rep(i,n){
			reps(j,i+1,n){
				if(D[i][j]){
					Q.push(j);
				}
			}
			if(Q.size() == 0)continue;
			if(Q.size() == 1){
				ans = max(ans,2);
				Q.pop();
			}
			else{
				vi.push_back(Q.front());
				Q.pop();
				while(Q.size()){
					int q = Q.front();Q.pop();
					int len = vi.size();
					bool f = true;
					rep(i,len){
						if(!D[vi[i]][q]){
							f = false;
							break;
						}
					}
					if(f)vi.push_back(q);
				}
				int g = vi.size();
				ans = max(ans,g+1);
				vi.clear();
			}
		}
		printf("%d\n",ans);
	}
	return 0;
}