import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { private static Scanner in = new Scanner(System.in); public static void main(String[] args) { int numOfCases = in.nextInt(); String[] answers = new String[numOfCases]; for(int i = 0; i < answers.length; i++){ answers[i] = solve(); } for(String each : answers){ System.out.println(each); } } private static String solve(){ int q = in.nextInt(); boolean result = true; for(int i = 0; i < q; i++){ int firstPoint = in.nextInt(); int nextPoint = in.nextInt(); if(firstPoint == 0 || nextPoint == 0){ } else if(result == true){ result = false; } } if(result){ return "YES"; } else { return "NO"; } } }