#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <sstream>
#include <vector>
using namespace std;

template <class T, class U>
T lexical_cast(const U& from) {
  T to;
  stringstream ss;
  ss << from; ss >> to;
  return to;
}

typedef double D;
const D EPS = 1e-8;

struct P {
  D x, y;
  P() { }
  P(D x_, D y_) : x(x_), y(y_) { }
};

struct C {
  P p; D r;
  C() { }
  C(P p_, D r_) : p(p_), r(r_) { }
};

P operator +(P a, P b) { return P(a.x + b.x, a.y + b.y); }
P operator -(P a, P b) { return P(a.x - b.x, a.y - b.y); }
P operator *(P a, D b) { return P(a.x * b, a.y * b); }
P operator /(P a, D b) { return P(a.x / b, a.y / b); }

int sig(D a, D b) {
  if(a < b - EPS) return -1;
  if(a > b + EPS) return +1;
  return 0;
}

D inp(P a, P b) { return a.x*b.x + a.y*b.y; }
D outp(P a, P b) { return a.x*b.y - a.y*b.x; }
D norm(P p) { return inp(p, p); }
D abs(P p) { return sqrt(norm(p)); }
P rot90(P p) { return P(-p.y, p.x); }

vector<P> cCC(C a, C b) {
  D d = abs(b.p - a.p);
  D x = (d*d + a.r*a.r - b.r*b.r) / (2*d);
  D y = sqrt(a.r*a.r - x*x);
  P v = (b.p - a.p) / d;
  vector<P> res;
  res.emplace_back(a.p + v*x + rot90(v)*y);
  res.emplace_back(a.p + v*x - rot90(v)*y);
  return res;
}

int main() {
  while(true) {
    int N; cin >> N;
    if(N == 0) break;
    vector<C> Cs(N);
    for(int i = 0; i < N; ++i) {
      string S; cin >> S;
      D x = lexical_cast<double>(S.substr(0, S.find(',')));
      D y = lexical_cast<double>(S.substr(S.find(',') + 1));
      Cs[i].p = P(x, y);
      Cs[i].r = 1.0;
    }
    int ans = 1;
    for(int i = 0; i < N; ++i) {
      for(int j = i + 1; j < N; ++j) {
        if(sig(abs(Cs[i].p - Cs[j].p), 2.0) <= 0) {
          vector<P> cross_point = cCC(Cs[i], Cs[j]);
          for(P p : cross_point) {
            int c = 0;
            for(int k = 0; k < N; ++k) {
              if(sig(abs(Cs[k].p - p), 1.0) <= 0) {
                ++c;
              }
            }
            ans = max(ans, c);
          }
        }
      }
    }
    cout << ans << endl;
  }
}