import java.util.*; import java.io.*; public class PointsOnARectangle { public static InputReader in; public static PrintWriter out; public static final int MOD = (int) 1e9 + 7; public static int[] P, rank; public static void main(String[] args) { in = new InputReader(System.in); out = new PrintWriter(System.out); int q = in.nextInt(); while(q-- > 0) { int n = in.nextInt(); int[][] p = new int[n][2]; P = new int[n]; rank = new int[n]; for (int i = 0; i < n; i++) P[i] = i; for (int i = 0; i < n; i++) { p[i][0] = in.nextInt(); p[i][1] = in.nextInt(); } for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { for (int k = 0; k < n; k++) { if(collinear(p[i], p[j], p[k])) { int par = findSet(i); mergeSet(par, j); mergeSet(par, k); } } } } HashSet hs = new HashSet(); for (int i = 0; i < n; i++) { hs.add(findSet(i)); } out.println((hs.size() <= 4)? "YES" : "NO"); } out.close(); } public static boolean collinear(int[] a, int[] b, int[] c) { return ((a[0] == b[0] && b[0] == c[0]) || (a[1] == b[1] && b[1] == c[1])); } public static int findSet(int x) { return P[x] = (P[x] == x ? x : findSet(P[x])); } public static void mergeSet(int x, int y) { int px = findSet(x), py = findSet(y); if(rank[px] > rank[py]) { P[py] = px; } else { P[px] = py; } if(rank[px] == rank[py]) { rank[py]++; } } static class Node implements Comparable { int u, v; long score; public Node(int u, int v) { this.u = u; this.v = v; } public void print() { System.out.println(u + " " + v + " " + score); } public int compareTo(Node that) { return Long.compare(this.score, that.score); } } static class InputReader { private InputStream stream; private byte[] buf = new byte[8192]; private int curChar, snumChars; private SpaceCharFilter filter; public InputReader(InputStream stream) { this.stream = stream; } public int snext() { if (snumChars == -1) throw new InputMismatchException(); if (curChar >= snumChars) { curChar = 0; try { snumChars = stream.read(buf); } catch (IOException e) { throw new InputMismatchException(); } if (snumChars <= 0) return -1; } return buf[curChar++]; } public int nextInt() { int c = snext(); while (isSpaceChar(c)) c = snext(); int sgn = 1; if (c == '-') { sgn = -1; c = snext(); } int res = 0; do { if (c < '0' || c > '9') throw new InputMismatchException(); res *= 10; res += c - '0'; c = snext(); } while (!isSpaceChar(c)); return res * sgn; } public long nextLong() { int c = snext(); while (isSpaceChar(c)) c = snext(); int sgn = 1; if (c == '-') { sgn = -1; c = snext(); } long res = 0; do { if (c < '0' || c > '9') throw new InputMismatchException(); res *= 10; res += c - '0'; c = snext(); } while (!isSpaceChar(c)); return res * sgn; } public int[] nextIntArray(int n) { int a[] = new int[n]; for (int i = 0; i < n; i++) a[i] = nextInt(); return a; } public String readString() { int c = snext(); while (isSpaceChar(c)) c = snext(); StringBuilder res = new StringBuilder(); do { res.appendCodePoint(c); c = snext(); } while (!isSpaceChar(c)); return res.toString(); } public boolean isSpaceChar(int c) { if (filter != null) return filter.isSpaceChar(c); return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; } public interface SpaceCharFilter { public boolean isSpaceChar(int ch); } } }