#include <stdio.h>
#include <list>
#include <string.h>
#include <algorithm>

using namespace std;

#define SQ(x) ((x) * (x))

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];
int degree[100];
int ans;

int check(char use[] , int depth)
{
	char next[100];
	int next_count;
	int i, j;
	
	if (depth > ans){
		ans = depth;
	}
	
	memset(next, 1, sizeof(next));
	
	next_count = n;
	for (i = 0; i < n; i++){
		for (j = 0; j < depth; j++){
			if (G[use[j]][i] == 0 && next[i] == 1){
				next[i] = 0;
				next_count--;
			}
		}
	}
	
	if (next_count == 0){
		return (0);
	}
	
	for (i = 0; i < n; i++){
		if (next[i] == 1 && degree[i] > ans - 1){
			use[depth] = i;
			check(use, depth + 1);
		}
	}
	
	return (0);
}

int main(void)
{
	double x[100], y[100];
	
	while (1){
		scanf("%d", &n);
		if (n == 0){
			break;
		}
		
		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 (SQ(x[i] - x[j]) + SQ(y[i] - y[j]) <= 4.0){
					G[i][j] = G[j][i] = 1;
				}
			}
		}
		
		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++){
			use[0] = sort_data[i].index;
			check(use, 1);
		}
		printf("%d\n", ans);
	}
	
	return (0);
}