There is a meteor shower on the sky and there are n meteors. The sky can be viewed as a 2D Euclid Plane and the meteor is point on this plane. 

Fox Ciel looks at the sky. She finds out that the orbit of each meteor is a straight line, and each meteor has a constant velocity. Now Ciel wants to know: what is the maximum number of meteors such that any pair met at the same position at a certain time? Note that the time is not limited and can be also negative. The meteors will never collide when they appear at the same position at the same time.

Input

The first line contains an integer n (1 ≤ n ≤ 1000). Each of the next n lines contains six integers: t1, x1, y1, t2, x2, y2 — the description of a meteor's orbit: at time t1, the current meteor is located at the point (x1, y1) and at time t2, the meteor is located at point (x2, y2) ( - 106 ≤ t1, x1, y1, t2, x2, y2 ≤ 106; t1 ≠ t2). 

There will be no two meteors are always in the same position for any time.

Output

Print a single integer — the maximum number of meteors such that any pair met at the same position at a certain time.

Examples

Input

2
0 0 1 1 0 2
0 1 0 1 2 0


Output

2


Input

3
-1 -1 0 3 3 0
0 2 -1 -1 3 -2
-2 0 -1 6 0 3


Output

3


Input

4
0 0 0 1 0 1
0 0 1 1 1 1
0 1 1 1 1 0
0 1 0 1 0 0


Output

1


Input

1
0 0 0 1 0 0


Output

1

Note

In example 1, meteor 1 and 2 meet in t=-1 at (0, 0).

<image>

In example 2, meteor 1 and 2 meet in t=1 at (1, 0), meteor 1 and 3 meet in t=0 at (0, 0) and meteor 2 and 3 meet in t=2 at (0, 1).

<image>

In example 3, no two meteor meet.

<image>

In example 4, there is only 1 meteor, and its velocity is zero.

<image>

If your browser doesn't support animation png, please see the gif version here: 

http://assets.codeforces.com/images/388e/example1.gif

http://assets.codeforces.com/images/388e/example2.gif

http://assets.codeforces.com/images/388e/example3.gif

http://assets.codeforces.com/images/388e/example4.gif
#include <bits/stdc++.h>
using namespace std;
int n, ans, an, cnt;
long double ti[1010];
struct Xn {
  long double x, y, vx, vy;
} xn[1010], tmp;
struct Dn {
  long double x, y;
} jd[1010];
inline long double cj(Dn u, Dn v) { return u.x * v.y - u.y * v.x; }
inline bool cmp(const Dn &u, const Dn &v) {
  if (fabs(cj(u, v)) < 1e-8) {
    if (fabs(u.x - v.x) > 1e-8) return u.x < v.x;
    return u.y < v.y;
  }
  return cj(u, v) < 0;
}
int main() {
  int i, j;
  long double a, b, c, d, e, f, t;
  cin >> n;
  for (i = 1; i <= n; i++) {
    scanf("%Lf%Lf%Lf%Lf%Lf%Lf", &c, &a, &b, &f, &d, &e);
    t = f - c;
    xn[i].vx = (d - a) / t;
    xn[i].vy = (e - b) / t;
    xn[i].x = a - xn[i].vx * c;
    xn[i].y = b - xn[i].vy * c;
  }
  for (i = 1; i <= n; i++) {
    cnt = 0;
    for (j = 1; j <= n; j++) {
      if (i == j) continue;
      tmp.x = xn[i].x - xn[j].x;
      tmp.y = xn[i].y - xn[j].y;
      tmp.vx = xn[i].vx - xn[j].vx;
      tmp.vy = xn[i].vy - xn[j].vy;
      t = fabs(tmp.vx) > 1e-8   ? tmp.x / tmp.vx
          : fabs(tmp.vy) > 1e-8 ? tmp.y / tmp.vy
                                : 0;
      if (fabs(tmp.vx * t - tmp.x) < 1e-8 && fabs(tmp.vy * t - tmp.y) < 1e-8) {
        ti[++cnt] = t;
        jd[cnt].x = tmp.vx;
        jd[cnt].y = tmp.vy;
      }
    }
    if (!cnt) continue;
    sort(ti + 1, ti + cnt + 1);
    an = 1;
    for (j = 2; j <= cnt; j++) {
      if (fabs(ti[j] - ti[j - 1]) < 1e-8)
        an++;
      else {
        ans = max(ans, an);
        an = 1;
      }
    }
    ans = max(an, ans);
    sort(jd + 1, jd + cnt + 1, cmp);
    an = 1;
    for (j = 2; j <= cnt; j++) {
      if (fabs(cj(jd[j], jd[j - 1])) < 1e-8) {
        if (fabs(jd[j].x - jd[j - 1].x) > 1e-8 ||
            fabs(jd[j].y - jd[j - 1].y) > 1e-8)
          an++;
      } else {
        ans = max(ans, an);
        an = 1;
      }
    }
    ans = max(ans, an);
  }
  cout << ans + 1;
}
