This page is still under construction.

Parts of this page are still being built. What you see may change.

Pascal Library

Interview

Time limit1sMemory limit128 MB

Summary
Given D attendance rows over N alumni, decide whether some alumnus attended every dinner.
Level

Easy2 of 10

Topics
Array, Implementation, Brute force
Solved
No attempts yet

Problem

Pascal University, one of the oldest in the country, needs to renovate its Library Building, because after all these centuries the building has started to show the effects of supporting the weight of the enormous amount of books it houses.

To help with the renovation, the University's Alumni Association decided to organize a series of fund-raising dinners, to which all alumni were invited. These events proved to be a huge success and several were held during the past year.

The organizers kept a spreadsheet recording which alumni attended each dinner. Now they want your help to determine whether any alumnus or alumna attended all of the dinners.

Input

The input contains several test cases. The first line of each test case contains two integers NN and DD, indicating respectively the number of alumni and the number of dinners organized (1≤N≤1001 \le N \le 100 and 1≤D≤5001 \le D \le 500). Alumni are identified by integers from 11 to NN. Each of the next DD lines describes the attendees of one dinner and contains NN integers XiX_i, where Xi=1X_i = 1 means that alumnus/alumna ii attended that dinner and Xi=0X_i = 0 means they did not.

The end of the input is indicated by N=D=0N = D = 0.

Output

For each test case, your program must produce one line of output containing either the word yes, if there is at least one alumnus/alumna who attended all of the dinners, or the word no otherwise.

Hint

  • Alumna: a former female student of a particular school, college or university.
  • Alumnus: a former male student of a particular school, college or university.
  • Alumni: former students of either sex of a particular school, college or university.

Examples1

  1. Example 1

    Input
    3 3
    1 1 1
    0 1 1
    1 1 1
    7 2
    1 0 1 0 1 0 1
    0 1 0 1 0 1 0
    0 0
    
    Expected output
    yes
    no