n students attended the first meeting of the Berland SU programming course (n is even). All students will be divided into two groups. Each group will be attending exactly one lesson each week during one of the five working days (Monday, Tuesday, Wednesday, Thursday and Friday), and the days chosen for the groups must be different. Furthermore, both groups should contain the same number of students.

Each student has filled a survey in which they told which days of the week are convenient for them to attend a lesson, and which are not. 

Your task is to determine if it is possible to choose two different week days to schedule the lessons for the group (the first group will attend the lesson on the first chosen day, the second group will attend the lesson on the second chosen day), and divide the students into two groups, so the groups have equal sizes, and for each student, the chosen lesson day for their group is convenient.

Input

The first line contains a single integer t (1 ≤ t ≤ 10^4) — the number of testcases.

Then the descriptions of t testcases follow.

The first line of each testcase contains one integer n (2 ≤ n ≤ 1 000) — the number of students.

The i-th of the next n lines contains 5 integers, each of them is 0 or 1. If the j-th integer is 1, then the i-th student can attend the lessons on the j-th day of the week. If the j-th integer is 0, then the i-th student cannot attend the lessons on the j-th day of the week. 

Additional constraints on the input: for each student, at least one of the days of the week is convenient, the total number of students over all testcases doesn't exceed 10^5.

Output

For each testcase print an answer. If it's possible to divide the students into two groups of equal sizes and choose different days for the groups so each student can attend the lesson in the chosen day of their group, print "YES" (without quotes). Otherwise, print "NO" (without quotes). 

Example

Input


2
4
1 0 0 1 0
0 1 0 0 1
0 0 0 1 0
0 1 0 1 0
2
0 0 0 1 0
0 0 0 1 0


Output


YES
NO

Note

In the first testcase, there is a way to meet all the constraints. For example, the first group can consist of the first and the third students, they will attend the lessons on Thursday (the fourth day); the second group can consist of the second and the fourth students, and they will attend the lessons on Tuesday (the second day).

In the second testcase, it is impossible to divide the students into groups so they attend the lessons on different days.

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;

public class B {
    public static void main(String[] args) {
        CustomScanner cs = new CustomScanner();
        int t = cs.nextInt();
        for(int i=0; i<t; i++) {
            int n = cs.nextInt();
            int[][] a = new int[n][5];
            for(int j=0; j<n; j++) {
                for(int k=0; k<5; k++) {
                   a[j][k] = cs.nextInt();
                }
            }
            solve(a, n);
        }
    }

    public static void solve(int[][] a, int n) {

        for(int i=0; i<5; i++) {
            Set<Integer> currSet = new HashSet<>();
            for(int j=0; j<a.length; j++) {
                if(a[j][i] == 1) {
                    currSet.add(j+1);
                }
            }

            Set<Integer> counter = counterpart(currSet, n);
            for(int j=i+1; j<5; j++) {
                Set<Integer> prospect = new HashSet<>();
                for(int k=0; k<a.length; k++) {
                    if(a[k][j] == 1) {
                        prospect.add(k+1);
                    }
                }

                if(prospect.containsAll(counter) && counter.size()!=n && counter.size()!=0) {
                    System.out.println("Yes");
                    return;
                }
            }
        }
        System.out.println("No");
    }

    private static Set<Integer> counterpart(Set<Integer> set, int n) {
        Set<Integer> subset = new HashSet<>();
        for(int i=1; i<=n; i++) {
            if(!set.contains(i)) {
                subset.add(i);
            }
        }
        return subset;
    }

    static class CustomScanner {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer("");
        String next() {
            while (!st.hasMoreTokens())
                try {
                    st=new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }
        int[] readArray(int n) {
            int[] a=new int[n];
            for (int i=0; i<n; i++) a[i]=nextInt();
            return a;
        }
        long nextLong() {
            return Long.parseLong(next());
        }
    }
}
