#include <bits/stdc++.h>
using namespace std;
double EPS = 1e-10;
double add(double a, double b) {
  if (abs(a + b) < EPS * (abs(a) + abs(b))) return 0;
  return a + b;
}
struct point {
  double x, y;
  point() {}
  point(double x, double y) : x(x), y(y) {}
  point operator+(point p) { return point(add(x, p.x), add(y, p.y)); }
  point operator-(point p) { return point(add(x, -p.x), add(y, -p.y)); }
  point operator*(double d) { return point(x * d, y * d); }
  point operator/(double d) { return point(x / d, y / d); }
};
struct circle {
  point p;
  double r;
};
vector<point> circles_cross(circle a, circle b) {
  vector<point> ret;
  double x = a.p.x - b.p.x, y = a.p.y - b.p.y;
  double L = x * x + y * y;
  if (L > pow(a.r + b.r, 2)) return ret;
  L = sqrt(L);
  double C = atan2(b.p.y - a.p.y, b.p.x - a.p.x);
  double alpha = acos((L * L + a.r * a.r - b.r * b.r) / (2 * L * a.r));
  point r1, r2;
  r1.x = a.p.x + cos(C + alpha), r1.y = a.p.y + sin(C + alpha);
  r2.x = a.p.x + cos(C - alpha), r2.y = a.p.y + sin(C - alpha);
  ret.push_back(r1), ret.push_back(r2);
  return ret;
}
int main(void) {
  int n;
  circle a[100];
  while (cin >> n, n) {
    vector<pair<double, double> > d;
    for (int i = 0; i < n; i++) {
      scanf("%lf,%lf", &a[i].p.x, &a[i].p.y);
      a[i].r = 1;
    }
    for (int i = 0; i < n; i++) {
      for (int j = i + 1; j < n; j++) {
        vector<point> p = circles_cross(a[i], a[j]);
        for (int k = 0; k < p.size(); k++) {
          d.push_back(make_pair(p[k].x, p[k].y));
        }
      }
    }
    for (int i = 0; i < d.size(); i++) {
      cout << d[i].first << " " << d[i].second << endl;
    }
    int count, ans = 1;
    for (int i = 0; i < d.size(); i++) {
      count = 0;
      for (int j = 0; j < n; j++) {
        if (pow(d[i].first - a[j].p.x, 2) + pow(d[i].second - a[j].p.y, 2) <=
            1.0)
          count++;
      }
      ans = max(ans, count);
    }
    cout << ans << endl;
  }
  return 0;
}
