Please subscribe to the official Codeforces channel in Telegram via the link: https://t.me/codeforces_official.
×

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ACM-ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

B. Switches and Lamps

time limit per test

3 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputYou are given *n* switches and *m* lamps. The *i*-th switch turns on some subset of the lamps. This information is given as the matrix *a* consisting of *n* rows and *m* columns where *a*_{i, j} = 1 if the *i*-th switch turns on the *j*-th lamp and *a*_{i, j} = 0 if the *i*-th switch is not connected to the *j*-th lamp.

Initially all *m* lamps are turned off.

Switches change state only from "off" to "on". It means that if you press two or more switches connected to the same lamp then the lamp will be turned on after any of this switches is pressed and will remain its state even if any switch connected to this lamp is pressed afterwards.

It is guaranteed that if you push all *n* switches then all *m* lamps will be turned on.

Your think that you have too many switches and you would like to ignore one of them.

Your task is to say if there exists such a switch that if you will ignore (not use) it but press all the other *n* - 1 switches then all the *m* lamps will be turned on.

Input

The first line of the input contains two integers *n* and *m* (1 ≤ *n*, *m* ≤ 2000) — the number of the switches and the number of the lamps.

The following *n* lines contain *m* characters each. The character *a*_{i, j} is equal to '1' if the *i*-th switch turns on the *j*-th lamp and '0' otherwise.

It is guaranteed that if you press all *n* switches all *m* lamps will be turned on.

Output

Print "YES" if there is a switch that if you will ignore it and press all the other *n* - 1 switches then all *m* lamps will be turned on. Print "NO" if there is no such switch.

Examples

Input

4 5

10101

01000

00111

10000

Output

YES

Input

4 5

10100

01000

00110

00101

Output

NO

Codeforces (c) Copyright 2010-2018 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Dec/13/2018 17:40:25 (f2).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|