import java.awt.Point; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; import java.util.StringTokenizer; class DEC15Long2 { public static void main(String[] args) throws NumberFormatException, IOException { // TODO Auto-generated method stub BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter log = new BufferedWriter(new OutputStreamWriter(System.out)); int i = Integer.parseInt(br.readLine()); for (int j = 0; j < i; j++) { int N = Integer.parseInt(br.readLine()); double[][] Store = new double[N][3]; StringTokenizer st; double[] slopes = new double[N]; double[] intercepts = new double[N]; for (int k = 0; k < N; k++) { st = new StringTokenizer(br.readLine()); Store[k][0] = Integer.parseInt(st.nextToken()); Store[k][1] = Integer.parseInt(st.nextToken()); Store[k][2] = Integer.parseInt(st.nextToken()); if (Store[k][1] != 0) { slopes[k] = -Store[k][0] / Store[k][1]; intercepts[k] = -Store[k][2] / Store[k][1]; if (Store[k][0] == 0.0) { slopes[k] = 0.0; } } else { slopes[k] = -0.0; intercepts[k] = -Store[k][2] / Store[k][0]; } } List points = new ArrayList(); for (int m = 0; m < N; m++) { points.add(new Point.Double(slopes[m], intercepts[m])); } Collections.sort(points, new Comparator() { public int compare(Point.Double x1, Point.Double x2) { int result = Double.compare(x1.getX(), x2.getX()); if (result == 0) { result = Double.compare(x1.getY(), x2.getY()); } return result; } }); int ans = 1; int tempans = 1; for (int m = 1; m < N; m++) { if (points.get(m - 1).getX() == points.get(m).getX()) { if ((1 / points.get(m - 1).getX()) < 0.0 && (1 / points.get(m).getX()) > 0.0) { if (tempans > ans) { ans = tempans; } tempans = 1; continue; } if (points.get(m - 1).getY() != points.get(m).getY()) { tempans++; if (tempans > ans) { ans = tempans; } } } else { tempans = 1; } } log.write(ans + "\n"); } log.flush(); } }