#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using pii = pair<int, int>;

#define EPS (1e-10)
#define equals(a, b) (fabs((a) - (b)) < EPS)
 
struct Point {
  double x, y;
  Point() {}
  Point (const double& x, const double& y) : x(x), y(y) {}
  Point& operator += (const Point& other) { x += other.x; y += other.y; return *this; }
  Point& operator -= (const Point& other) { x -= other.x; y -= other.y; return *this; }
  Point& operator *= (const double& factor) { x *= factor; y *= factor; return *this; }
  Point& operator /= (const double& factor) { x /= factor; y /= factor; return *this; }
};
using Vector = Point;
using Polygon = vector<Point>;
 
Point operator + (const Point&lhs, const Point& rhs) { return Point(lhs.x + rhs.x, lhs.y + rhs.y); }
Point operator - (const Point& lhs, const Point& rhs) { return Point(lhs.x - rhs.x, lhs.y - rhs.y); }
Point operator * (const Point& lhs, const double& factor) { return Point(lhs.x * factor, lhs.y * factor); }
Point operator * (const double& factor, const Point& rhs) { return Point(factor * rhs.x, factor * rhs.y); }
Point operator / (const Point& lhs, const double& factor) { return Point(lhs.x / factor, lhs.y / factor); }
double operator * (const Point& lhs, const Point& rhs) { return lhs.x * rhs.x + lhs.y * rhs.y; }
double operator ^ (const Point& lhs, const Point& rhs) { return lhs.x * rhs.y - lhs.y * rhs.x; }
bool operator == (const Point& lhs, const Point& rhs) { return equals(lhs.x, rhs.x) && equals(lhs.y, rhs.y); }
bool operator != (const Point& lhs, const Point& rhs) { return !(lhs == rhs); }
bool operator < (const Point& lhs, const Point& rhs) { return !equals(lhs.x, rhs.x) ? lhs.x < rhs.x : lhs.y < rhs.y; }
bool operator > (const Point& lhs, const Point& rhs) { return rhs < lhs; }
bool operator <= (const Point& lhs, const Point& rhs) { return !(lhs > rhs); }
bool operator >= (const Point& lhs, const Point& rhs) { return !(lhs < rhs); }
istream& operator >> (istream& is, Point& point) { return is >> point.x >> point.y; }
ostream& operator << (ostream& os, Point& point) { return os << "(" << point.x << "," << point.y << ")"; }
double norm(const Point& point) { return point.x * point.x + point.y * point.y; }
double abs(const Point& point) { return sqrt(norm(point)); }
double arg(const Point& point) { return atan2(point.y, point.x); }
Point polar(const double& a, const double& r) { return Point(cos(r) * a, sin(r) * a); }
bool sort_x(const Point& lhs, const Point& rhs) { return !equals(lhs.x, rhs.x) ? lhs.x < rhs.x : lhs.y < rhs.y; }
bool sort_y(const Point& lhs, const Point& rhs) { return !equals(lhs.y, rhs.y) ? lhs.y < rhs.y : lhs.x < rhs.x; }
 
struct Circle {
  Point c;
  double r;
  Circle() {}
  Circle(const Point& c, const double& r) : c(c), r(r) {}
};
 
istream& operator >> (istream& is, Circle& circle) { return is >> circle.c >> circle.r; }
ostream& operator << (ostream& os, Circle& circle) { return os << "(" << circle.c << "," << circle.r << ")"; }
 
Polygon getCrossPointCC(const Circle& c1, const Circle& c2) {
  Polygon ps;
  double d = abs(c1.c - c2.c);
  if (equals(d, c1.r + c2.r)) {
    ps.emplace_back((c2.c - c1.c) * c1.r / (c1.r + c2.r));
  } else if (c1.r + c2.r - d > EPS) {
    double a = acos((c1.r * c1.r + d * d - c2.r * c2.r) / (2 * c1.r * d));
    double t = arg(c2.c - c1.c);
    ps.emplace_back(c1.c + polar(c1.r, t + a));
    ps.emplace_back(c1.c + polar(c1.r, t - a));
  }
  return ps;
}

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  int n;
  while (cin >> n, n) {
    vector<Circle> cs(n);
    for (int i = 0; i < n; i++) {
      char ch;
      cin >> cs[i].c.x >> ch >> cs[i].c.y;
      cs[i].r = 1;
    }
    int ans = 1;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        if (i == j) continue;
        auto ps = getCrossPointCC(cs[i], cs[j]);
        if (ps.empty()) continue;
        for (auto &p : ps) {
          int sub = 0;
          for (int k = 0; k < n; k++) {
            sub += (cs[k].r - abs(cs[k].c - p) > -EPS);
          }
          ans = max(ans, sub);
        }
      }
    }
    cout << ans << endl;
  }

  return 0;
}
