Pareto domination
A point with coordinates (x1, x2, …, xn) is called dominated in Pareto’s sense by a point with coordinates (y1, y2, …, yn), if for each i (1 ≤ i ≤ n) the inequality xi ≤ yi holds. A set of some points is given. Your task is to find the number of points in this set, that are not dominated in Pareto’s sense by any other point in the given set.
Input
First line of input contains the quantity of tests T (1 ≤ T ≤ 10). First line of each test case contains two numbers: N (1 ≤ N ≤ 50000) – the number of points in the set and M (1 ≤ M ≤ 4) – the space dimension. Then there are N lines, each of which contains M integers – coordinates of a point, separated by spaces (each coordinate is less than 10^9 by its absolute value). All points in the set are different.
Output
Output T lines of the form "Case #A: B", where A is the number of test (beginning from 1), B is the quantity of non-dominated points.