#include <bits/stdc++.h>
using namespace std;
bool debug = 1;
int n, m, k;
int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
long long ln, lk, lm;
struct pt {
  double x, y, t, x2, y2, t2;
  double delT, dx, dy, x0, y0;
  void init() {
    delT = t2 - t;
    dx = (x2 - x) / delT;
    dy = (y2 - y) / delT;
    x0 = x - dx * t;
    y0 = y - dy * t;
  }
} p[1005];
double a[1005];
pair<double, double> b[1005];
double cm(pair<double, double> x, pair<double, double> y) {
  return x.first * y.second - y.first * x.second;
}
bool cmp(pair<double, double> x, pair<double, double> y) {
  double c = cm(x, y);
  if (fabs(c) < 1e-7) {
    return fabs(x.first - y.first) < 1e-7 ? x.second < y.second
                                          : x.first < y.first;
  }
  return c < 0;
}
int main() {
  scanf("%d", &n);
  for (int(i) = 1; (i) <= (int)(n); (i)++) {
    scanf("%lf%lf%lf%lf%lf%lf", &p[i].t, &p[i].x, &p[i].y, &p[i].t2, &p[i].x2,
          &p[i].y2);
    p[i].init();
  }
  int ans = 0;
  for (int(i) = 1; (i) <= (int)(n); (i)++) {
    int tot = 0;
    for (int(j) = 1; (j) <= (int)(n); (j)++)
      if (i != j) {
        double X = p[j].x0 - p[i].x0, Y = p[j].y0 - p[i].y0;
        double sX = p[j].dx - p[i].dx, sY = p[j].dy - p[i].dy;
        double t = fabs(sX) < 1e-7 ? (fabs(sY) < 1e-7 ? 0 : Y / sY) : X / sX;
        if (fabs(X - sX * t) < 1e-7 && fabs(Y - sY * t) < 1e-7) {
          a[++tot] = t;
          b[tot].first = sX;
          b[tot].second = sY;
        }
      }
    sort(a + 1, a + 1 + tot);
    int cnt = 0;
    for (int(j) = 1; (j) <= (int)(tot); (j)++) {
      if (fabs(a[j] - a[j - 1]) < 1e-7)
        cnt++;
      else
        cnt = 1;
      ans = max(ans, cnt);
    }
    sort(b + 1, b + 1 + tot, cmp);
    cnt = 1;
    for (int j = 2; j <= tot; j++) {
      if (fabs(cm(b[j], b[j - 1])) < 1e-7) {
        if (fabs(b[j].first - b[j - 1].first) > 1e-7 ||
            fabs(b[j].second - b[j - 1].second) > 1e-7) {
          cnt++;
        }
      } else
        cnt = 1;
      ans = max(ans, cnt);
    }
  }
  printf("%d\n", ++ans);
  return 0;
}
