#include <bits/stdc++.h>
using namespace std;
double EPS = 1e-9;
double sq(double a) { return a * a; }
double dis(pair<double, double> p1, pair<double, double> p2) {
  return sqrt(sq(p1.first - p2.first) + sq(p1.second - p2.second));
}
pair<double, double> add(pair<double, double> p1, pair<double, double> p2) {
  return make_pair(p1.first + p2.first, p1.second + p2.second);
}
pair<double, double> minu(pair<double, double> p1, pair<double, double> p2) {
  return make_pair(p1.first - p2.first, p1.second - p2.second);
}
double inter(pair<double, double> p1, pair<double, double> p2) {
  return sqrt(sq(p1.first - p2.first) + sq(p1.second - p2.second));
}
int main() {
  double n;
  while (cin >> n, n) {
    double x, y, ans = 0;
    char c;
    vector<pair<double, double> > vec;
    for (int i = 0; i < n; i++) {
      cin >> x >> c >> y;
      vec.push_back(make_pair(x, y));
    }
    for (int i = 0; i < n - 1; i++) {
      for (int j = i + 1; j < n; j++) {
        if (dis(vec[i], vec[j]) <= 2) {
          cout << i + 1 << " " << j + 1 << endl;
          double pm = sqrt(1 - sq(dis(vec[i], vec[j]) / 2));
          double lam = pm / dis(vec[i], vec[j]);
          pair<double, double> m = add(vec[i], vec[j]);
          m.first /= 2;
          m.second /= 2;
          pair<double, double> pt =
              make_pair(lam * (vec[i].second - vec[j].second),
                        lam * (vec[j].first - vec[i].first));
          pair<double, double> p1 = add(m, pt);
          pair<double, double> p2 = minu(m, pt);
          int cou = 0;
          if (p1.first >= 0 - EPS && p1.second >= 0 - EPS &&
              p1.first <= 10 + EPS && p1.second <= 10 + EPS)
            for (int a = 0; a < n; a++) {
              if (dis(vec[a], p1) <= 1 + EPS) {
                cou++;
              }
            }
          if (ans < cou) ans = cou;
          cou = 0;
          if (p2.first >= 0 - EPS && p2.second >= 0 - EPS &&
              p2.first <= 10 + EPS && p2.second <= 10 + EPS)
            for (int a = 0; a < n; a++) {
              if (dis(vec[a], p2) <= 1 + EPS) cou++;
            }
          if (ans < cou) ans = cou;
        }
      }
    }
    cout << ans << endl;
  }
}
