q = gets.strip.to_i q.times do n = gets.strip.to_i ans = "NO" if n <= 4 min_point = 10 ** 5 max_point = -10 ** 5 points = [] n.times do x, y = gets.strip.split.map(&:to_i) min_point = [x, y, min_point].min max_point = [x, y, max_point].max points.push [x, y] end ans = "YES" points.each do |i, j| if i != min_point && i != max_point && j != min_point && j != max_point ans = "NO" break end end end puts ans end