import java.io.*; import java.util.*; public class Solution { public static void main(String[] args) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ Scanner in = new Scanner(System.in); int q = in.nextInt(); for (int count = 0; count < q; count++) { int n = in.nextInt(); ArrayList xList = new ArrayList(); ArrayList yList = new ArrayList(); for (int num = 0; num < n; num++) { int x = in.nextInt(); int y = in.nextInt(); xList.add(x); yList.add(y); } if (n <= 2 || (xList.size() == 2 && yList.size() == 2)) { System.out.println("YES"); } else { System.out.println("NO"); } } in.close(); } }