Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset.

k experienced teams are participating in the contest. Some of these teams already know some of the problems. To make the contest interesting for them, each of the teams should know at most half of the selected problems.

Determine if Snark and Philip can make an interesting problemset!


-----Input-----

The first line contains two integers n, k (1 ≤ n ≤ 10^5, 1 ≤ k ≤ 4) — the number of problems and the number of experienced teams.

Each of the next n lines contains k integers, each equal to 0 or 1. The j-th number in the i-th line is 1 if j-th team knows i-th problem and 0 otherwise.


-----Output-----

Print "YES" (quotes for clarity), if it is possible to make an interesting problemset, and "NO" otherwise.

You can print each character either upper- or lowercase ("YeS" and "yes" are valid when the answer is "YES").


-----Examples-----
Input
5 3
1 0 1
1 1 0
1 0 0
1 0 0
1 0 0

Output
NO

Input
3 2
1 0
1 1
0 1

Output
YES



-----Note-----

In the first example you can't make any interesting problemset, because the first team knows all problems.

In the second example you can choose the first and the third problems.

Source: codeforces | Difficulty: MEDIUM
Tags: Dynamic programming

Bit manipulation

Complete search

Constructive algorithms


Solutions:
(n, k) = input().split()
n = int(n)
k = int(k)
inputList = []
twoPkList = []
kList = []
result = 'NO'
for j in range(k + 1):
	kList.append(0)
for i in range(2 ** k - 2):
	twoPkList.append(list(kList))
for i in range(n):
	onesList = []
	inputList = input().split()
	summation = 0
	for j in range(k):
		inputList[j] = int(inputList[j])
		if inputList[j]:
			onesList.append(j)
			summation += inputList[j] * 2 ** (k - 1 - j)
	if summation == 0:
		result = 'YES'
		break
	if summation == 2 ** k - 1:
		continue
	if twoPkList[2 ** k - 2 - summation][k]:
		result = 'YES'
		break
	for (index, row) in enumerate(twoPkList):
		adjacentZeros = 0
		if row[k] and (not index == summation - 1):
			for position in onesList:
				if row[position] == 0:
					adjacentZeros += 1
		if adjacentZeros == len(onesList):
			result = 'YES'
			break
	if result == 'YES':
		break
	if not twoPkList[summation - 1][k]:
		twoPkList[summation - 1] = list(inputList)
		twoPkList[summation - 1].append(1)
print(result)


(n, k) = map(int, input().split())
freq = {mask: 0 for mask in range(1 << k)}
for i in range(n):
	freq[int(''.join([x for x in input().split()]), 2)] += 1

def solve(freq, k):
	if freq[0] >= 1:
		return True
	for mask1 in range(1 << k):
		for mask2 in range(1 << k):
			if mask1 & mask2 == 0 and freq[mask1] >= 1 and (freq[mask2] >= 1):
				return True
	return False
print('YES' if solve(freq, k) else 'NO')


import sys
input = sys.stdin.readline
(n, k) = list(map(int, input().split()))
ps = set()
for _ in range(n):
	ps.add(tuple(map(int, input().split())))
if tuple([0] * k) in ps:
	print('YES')
	exit()
for first in ps:
	for i in range(2 ** k):
		binary = list(map(int, bin(i)[2:]))
		binary = tuple([0] * (k - len(binary)) + binary)
		x = [1 - a for a in first]
		for i in range(k):
			x[i] = max(x[i] - binary[i], 0)
		x = tuple(x)
		if x in ps and first in ps:
			print('YES')
			exit()
print('NO')


import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
import collections
from itertools import permutations
from collections import defaultdict
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
(problems, teams) = [int(x) for x in input().split()]
teams1 = [0 for x in range(teams)]
known = set()
for i in range(problems):
	questions = ''.join(input().split())
	known.add(int(questions, 2))
known = sorted(known)
z = len(known)
for i in range(z):
	for j in range(i, z):
		if known[i] & known[j] == 0:
			print('YES')
			exit()
print('NO')


(n, k) = map(int, input().split())
arr = [0 for i in range(2 ** k)]
for _ in range(n):
	s = input()
	s = s.replace(' ', '')
	kk = int(s, 2)
	arr[kk] = 1
f = False
for i in range(2 ** k):
	if arr[i] == 0:
		continue
	if i == 0:
		f = True
	for j in range(i + 1, 2 ** k):
		if arr[j] == 0:
			continue
		if i & j == 0:
			f = True
if f:
	print('YES')
else:
	print('NO')


(n, k) = [int(i) for i in input().split()]
K = 1 << k
p = [0] * K
for i in range(n):
	pi = [int(j) for j in input().split()]
	pc = sum((pi[j] << j for j in range(k)))
	p[pc] += 1
s = [0] * k

def go(i0, used):
	if i0 >= K:
		return False
	if p[i0]:
		s0 = s[:]
		ok = True
		used += 1
		for j in range(k):
			f = i0 >> j & 1
			assert f == 0 or f == 1
			s[j] += i0 >> j & 1
			if s[j] * 2 > used:
				ok = False
		if ok:
			return True
		if go(i0 + 1, used):
			return True
		s[:] = s0
		used -= 1
	return go(i0 + 1, used)
ans = 'YES' if go(0, 0) else 'NO'
print(ans)


(n, k) = map(int, input().split())
kij = [list(map(int, input().split())) for i in range(n)]
kji = [[max(sum(kij[j]) / k, kij[j][i]) for j in range(n)] for i in range(k)]
km = [min(kji[i]) for i in range(k)]
if max(km) == 1 or sum(km) > k / 2:
	print('NO')
elif k == 2 or k == 3 or min(km) <= 0.25:
	print('YES')
else:
	ans = 'NO'
	num = -1
	num2 = -1
	num3 = -1
	num4 = -1
	num5 = -1
	num6 = -1
	for i in range(n):
		if kji[0][i] == 0.5:
			if kji[1][i] == 0.5:
				num = 2
				num2 = 3
			elif kji[2][i] == 0.5:
				num3 = 1
				num4 = 3
			else:
				num5 = 2
				num6 = 1
	if num != -1:
		for i in range(n):
			if kji[num][i] == 0.5 and kji[num2][i] == 0.5:
				ans = 'YES'
				break
	if num3 != -1:
		for i in range(n):
			if kji[num3][i] == 0.5 and kji[num4][i] == 0.5:
				ans = 'YES'
				break
	if num5 != -1:
		for i in range(n):
			if kji[num5][i] == 0.5 and kji[num6][i] == 0.5:
				ans = 'YES'
				break
	print(ans)


from collections import Counter, defaultdict, deque
import heapq as hq
import itertools
import math
import sys
input = sys.stdin.readline

def solve():
	(n, k) = [int(x) for x in input().split()]
	s = set()
	for i in range(n):
		nxt = int(''.join([x for x in input().strip().split()]), 2)
		s.add(nxt)
	s = list(s)
	l = len(s)
	for i in range(l):
		for j in range(i, l):
			res = s[i] & s[j]
			if not res:
				print('YES')
				return
	print('No')
tt = 1
for test in range(tt):
	solve()


(n, k) = map(int, input().split())
a = set()
for i in range(n):
	a.add(input())
for w in a:
	for w2 in a:
		x = list(map(int, w.split()))
		y = list(map(int, w2.split()))
		count = 0
		for i in range(k):
			if x[i] + y[i] != 2:
				count += 1
		if count == k:
			yes = True
			print('YES')
			quit()
print('NO')


(n, k) = map(int, input().split())
a = []
for i in range(n):
	l = list(map(int, input().split()))
	a.append(l)
a = list(set((tuple(i) for i in a)))
for i in range(len(a)):
	flag = False
	for j in range(len(a)):
		cnt = 0
		for x in range(k):
			if a[i][x] == 1 and a[j][x] != 0:
				continue
			else:
				cnt += 1
		if cnt == k:
			flag = True
			break
	if flag:
		break
if flag:
	print('Yes')
else:
	print('No')


import sys
(N, K) = list(map(int, input().split()))
states = set([(0, 0)])
for _ in range(N):
	can_solve = list(map(int, input().split()))
	next_states = set()
	for (selected, bm) in states:
		cnts = [bm >> i & 1 for i in range(K)][::-1]
		next_cnts = [cnts[i] + can_solve[i] for i in range(K)]
		next_selected = selected + 1
		if max(next_cnts) <= next_selected / 2 and next_selected > 0:
			print('YES')
			return
		if max(next_cnts) <= 1 and next_selected <= 4:
			bin_num = int(''.join(map(str, next_cnts)), 2)
			next_states.add((next_selected, bin_num))
	states |= next_states
print('NO')


from itertools import accumulate, permutations, combinations
from sys import stdout
R = lambda : map(int, input().split())
(n, k) = R()
s = set((tuple(R()) for x in range(n)))
res = False
for l in range(1, len(s) + 1):
	for x in combinations(s, l):
		res = res or all((2 * sum(t) <= l for t in zip(*x)))
print('YES' if res else 'NO')


(n, k1) = tuple(map(int, input().split()))
l = []
ans = 0
for i in range(n):
	l.append(list(map(int, input().split())))
d1 = [[[0], [0]], [[0], [1]]]
d2 = [[[0, 0], [0, 1]], [[0, 0], [1, 0]], [[0, 0], [0, 0]], [[0, 0], [1, 1]], [[0, 1], [1, 0]]]
d3 = []
d4 = []
for i in range(1):
	for j in range(2):
		for k in range(2):
			for x in range(2):
				for y in range(2):
					for z in range(2):
						if i + x < 2 and j + y < 2 and (k + z < 2):
							d3.append([[i, j, k], [x, y, z]])
for i in range(1):
	for j in range(2):
		for k in range(2):
			for t in range(2):
				for x in range(2):
					for y in range(2):
						for z in range(2):
							for w in range(2):
								if i + x < 2 and j + y < 2 and (k + z < 2) and (t + w < 2):
									d4.append([[i, j, k, t], [x, y, z, w]])
if k1 == 1:
	d = d1
elif k1 == 2:
	d = d2
elif k1 == 3:
	d = d3
else:
	d = d4
for i in range(len(d)):
	if d[i][0] in l and d[i][1] in l:
		ans = 1
		break
if ans == 1:
	print('YES')
else:
	print('NO')


def clc(m, k):
	opts = ['']
	for i in range(k):
		if m[i] == 1:
			opts = [o + '0' for o in opts]
		else:
			opts = [o + '0' for o in opts] + [o + '1' for o in opts]
	return opts
(n, k) = map(int, input().split())
s = set()
for _ in range(n):
	m = list(map(int, input().split()))
	if k - sum(m) == k:
		print('YES')
		exit()
		break
	else:
		opts = clc(m, k)
		for o in opts:
			if o in s:
				print('YES')
				exit()
				break
		s.add(''.join([str(i) for i in m]))
print('NO')


(n, k) = list(map(int, input().split()))
sq_k = 2 ** k
rec = [0] * sq_k
for _ in range(n):
	ind = int(''.join(input().split()), 2)
	rec[ind] += 1
ans = 'YES'
if rec[0] > 0:
	print(ans)
	exit()
for i in range(sq_k):
	for j in range(sq_k):
		if rec[i] > 0 and rec[j] > 0:
			if i & j == 0:
				print(ans)
				exit()
print('NO')


(n, k) = map(int, input().split())
temp = {}
for i in range(n):
	c = int(''.join(input().split()), 2)
	temp[c] = 1
f = 0
for i in range((1 << k) + 1):
	for j in range((1 << k) + 1):
		if temp.get(i, 0) and temp.get(j, 0) and (not i & j):
			f = 1
if f:
	print('YES')
else:
	print('NO')


(n, k) = [int(i) for i in input().split()]
store = set()
for i in range(n):
	temp = [int(_) for _ in input().split()]
	temp = tuple(temp)
	store.add(temp)
store = list(store)

def fun3(arr, total, a, b, c, index):
	if 2 * a <= total and 2 * b <= total and (2 * c <= total) and (total != 0):
		return 1
	if index >= len(arr):
		return 0
	x = fun3(arr, total + 1, a + arr[index][0], b + arr[index][1], c + arr[index][2], index + 1)
	y = fun3(arr, total, a, b, c, index + 1)
	if x == 1 or y == 1:
		return 1
	else:
		return 0

def fun4(arr, total, a, b, c, d, index):
	if 2 * a <= total and 2 * b <= total and (2 * c <= total) and (d * 2 <= total) and (total != 0):
		return 1
	if index >= len(arr):
		return 0
	x = fun4(arr, total + 1, a + arr[index][0], b + arr[index][1], c + arr[index][2], d + arr[index][3], index + 1)
	y = fun4(arr, total, a, b, c, d, index + 1)
	if x == 1 or y == 1:
		return 1
	else:
		return 0
if k == 1:
	flag = 0
	for i in range(len(store)):
		if store[i][0] == 0:
			flag = 1
			break
	if flag == 0:
		print('NO')
	else:
		print('YES')
elif k == 2:
	flag1 = 0
	flag2 = 0
	flag3 = 0
	for i in range(len(store)):
		a = store[i][0]
		b = store[i][1]
		if a == 0 and b == 0:
			flag1 = 1
			break
		elif a == 0 and b == 1:
			flag2 = 1
		elif a == 1 and b == 0:
			flag3 = 1
	if flag1 == 1:
		print('YES')
	elif flag2 == 1 and flag3 == 1:
		print('YES')
	else:
		print('NO')
elif k == 3:
	a = fun3(store, 0, 0, 0, 0, 0)
	if a == 0:
		print('NO')
	else:
		print('YES')
else:
	a = fun4(store, 0, 0, 0, 0, 0, 0)
	if a == 0:
		print('NO')
	else:
		print('YES')


def bel(mask, bit):
	return mask & 1 << bit != 0
read = lambda : map(int, input().split())
(n, k) = read()
f = [0] * 100
for i in range(n):
	cur = int(''.join(input().split()), 2)
	cur ^= (1 << k) - 1
	f[cur] = 1
ans = 'NO'
if k == 1:
	if f[1]:
		ans = 'YES'
if k == 2:
	f1 = f2 = 0
	for i in range(4):
		if f[i]:
			if bel(i, 0):
				f1 = 1
			if bel(i, 1):
				f2 = 1
	if f1 and f2:
		ans = 'YES'
if k == 3:
	p = [0] * 3
	for i in range(8):
		if f[i]:
			for j in range(3):
				if bel(i, j):
					p[j] = 1
	for i in range(8):
		if f[i]:
			if bel(i, 0) and bel(i, 1) and p[2]:
				ans = 'YES'
			if bel(i, 0) and p[1] and bel(i, 2):
				ans = 'YES'
			if p[0] and bel(i, 1) and bel(i, 2):
				ans = 'YES'
if k == 4:
	for i in range(16):
		if f[i]:
			for j in range(16):
				if f[j]:
					if i | j == 15:
						ans = 'YES'
print(ans)


(n, k) = map(int, input().split())
arr = [list(map(int, input().split())) for _ in range(n)]
vis = [0] * (1 << k)
for i in arr:
	x = 0
	for j in i:
		x = 2 * x + j
	if x == 0:
		print('YES')
		exit()
	for j in range(len(vis)):
		if j & x == 0 and vis[j]:
			print('YES')
			exit()
	vis[x] = 1
print('NO')


from collections import Counter

def f(g):
	st = Counter(g)
	l = list(st.keys())
	for i in range(len(l)):
		c = 0
		if max(l[i]) == 0:
			return 'YES'
		if st[l[i]] >= 2:
			c = 1
		for j in range(i + c):
			t = list(map(lambda x, y: x + y, l[i], l[j]))
			if max(t) == 2:
				continue
			else:
				return 'YES'
	return 'NO'
(n, k) = map(int, input().strip().split())
g = []
for i in range(n):
	g.append(tuple(map(int, input().strip().split())))
print(f(g))


(n, k) = [int(i) for i in input().split()]
s = set([int(''.join(input().split()), base=2) for j in range(n)])
for t in s:
	for m in range(1 << k):
		if m in s:
			for i in range(k):
				if t >> i & 1 and m >> i & 1:
					break
			else:
				print('YES')
				return
print('NO')


(n, k) = map(int, input().split())
s = []
A = []
for i in range(16):
	A.append(False)
for i in range(n):
	s.append(input())
	s[i] = s[i].replace(' ', '')
	s[i] = s[i] + '0' * (4 - k)
	s[i] = int(s[i], 2)
	A[s[i]] = True
fl = False
if A[0]:
	fl = True
if A[1]:
	for i in range(2, 16, 2):
		if A[i]:
			fl = True
if A[2] and (A[4] or A[5] or A[8] or A[9] or A[12] or A[13] or A[1]):
	fl = True
if A[4] and (A[8] or A[9] or A[10] or A[11] or A[3] or A[1] or A[2]):
	fl = True
if A[8]:
	for i in range(8):
		if A[i]:
			fl = True
if A[3] and A[12]:
	fl = True
if A[6] and A[9]:
	fl = True
if A[5] and A[10]:
	fl = True
if fl:
	print('YES')
else:
	print('NO')


m = []
(n, k) = [int(x) for x in input().split()]
for i in range(n):
	m.append(list(map(int, input().split())))
mp = [0] * 100
for i in range(n):
	s = ''
	for j in range(k):
		s += str(m[i][j])
	mp[int(s, 2)] += 1
if mp[0]:
	print('YES')
	exit()
if mp[1]:
	if mp[2] or mp[4] or mp[6] or mp[8] or mp[10] or mp[12] or mp[14]:
		print('YES')
		exit()
if mp[2]:
	if mp[1] or mp[4] or mp[5] or mp[8] or mp[9] or mp[12] or mp[13]:
		print('YES')
		exit()
if mp[3]:
	if mp[4] or mp[8] or mp[12]:
		print('YES')
		exit()
if mp[4]:
	if mp[1] or mp[2] or mp[3] or mp[8] or mp[9] or mp[10] or mp[11]:
		print('YES')
		exit()
if mp[5]:
	if mp[2] or mp[8] or mp[10]:
		print('YES')
		exit()
if mp[6]:
	if mp[1] or mp[8] or mp[9]:
		print('YES')
		exit()
if mp[7]:
	if mp[8]:
		print('YES')
		exit()
print('NO')


def fun(l):
	s = 0
	for i in range(len(l)):
		s += l[i] << i
	return s
la = [0 for i in range(16)]
(n, k) = [int(i) for i in input().split()]
for i in range(n):
	la[fun([int(j) for j in input().split()])] += 1
f = 0
for i in range(16):
	if la[i] > 0:
		for j in range(i + 1, 16):
			if la[j] > 0:
				if i & j == 0:
					f = 1
if f == 1 or la[0] > 0:
	print('yes')
else:
	print('no')


(n, k) = list(map(int, input().split()))
cnt = {}
for i in range(2 ** k):
	cnt[bin(i)[2:].zfill(k)] = 0
for i in range(n):
	l = input().split()
	s = ''
	for x in l:
		s += x
	cnt[s] += 1

def f1():
	if cnt['0'] > 0:
		print('YES')
	else:
		print('NO')

def f2():
	if cnt['00'] > 0:
		print('YES')
		return
	if cnt['01'] > 0 and cnt['10'] > 0:
		print('YES')
		return
	print('NO')

def f3():
	if cnt['000'] > 0:
		print('YES')
		return
	a = int(cnt['100'] > 0)
	b = int(cnt['010'] > 0)
	c = int(cnt['001'] > 0)
	if a + b + c > 1:
		print('YES')
		return
	if a and cnt['011']:
		print('YES')
		return
	if b and cnt['101']:
		print('YES')
		return
	if c and cnt['110']:
		print('YES')
		return
	print('NO')

def f4():
	if cnt['0000'] > 0:
		print('YES')
		return
	ms = ['0001', '1110', '0010', '1101', '0100', '1011', '1000', '0111', '1100', '0011', '1010', '0101', '1001', '0110']
	for i in range(len(ms) // 2):
		if cnt[ms[2 * i]] > 0 and cnt[ms[2 * i + 1]] > 0:
			print('YES')
			return
	x = 0
	for i in range(4):
		if cnt[ms[i * 2]] > 0:
			x += 1
	if x > 1:
		print('YES')
		return
	ind = []
	if cnt['0001'] > 0:
		ind.append(3)
	if cnt['0010'] > 0:
		ind.append(2)
	if cnt['0100'] > 0:
		ind.append(1)
	if cnt['1000'] > 0:
		ind.append(0)
	for i in range(len(ms)):
		b = False
		for x in ind:
			if ms[i][x] == '0':
				b = True
		if not b:
			continue
		if cnt[ms[i]] > 0:
			print('YES')
			return
	print('NO')
	return
[f1, f2, f3, f4][k - 1]()


(n, m) = map(int, input().split())
c = [0] * 16
for _ in range(n):
	c[int(''.join(input().split()), 2)] += 1
yes = c[0]
for i in range(1 << m):
	if c[i]:
		for j in range(i + 1, 1 << m):
			if 0 == i & j and c[j]:
				yes = 1
print('YES' if yes else 'NO')


(n, k) = map(int, input().split())
probs = list(([0] * n for _ in range(k)))
pbtype = [0] * 2 ** k
e = [False] * 2 ** k
ei = [False] * k
for i in range(n):
	x = list(map(int, input().split()))
	sum = 0
	for j in range(k):
		if x[j] == 0:
			sum += 2 ** j
			ei[j] = True
	pbtype[sum] += 1
	e[sum] = True
success = False
if e[2 ** k - 1]:
	success = True
for i in range(k):
	if e[2 ** k - 1 - 2 ** i] and ei[i]:
		success = True
if k == 4:
	if e[3] and e[12]:
		success = True
	if e[6] and e[9]:
		success = True
	if e[5] and e[10]:
		success = True
if success:
	print('YES')
else:
	print('NO')


(n, k) = [int(x) for x in input().split()]
bit_array = set()
for i in range(n):
	temp = input()
	temp2 = ''
	for c in temp:
		if c != ' ':
			temp2 += c
	bit_array.add(temp2)
ls = list(bit_array)
ans = 'no'
for x in ls:
	for y in ls:
		temp = ''
		for i in range(k):
			temp += str(int(x[i]) & int(y[i]))
		if temp == '0' * k:
			ans = 'yes'
			break
print(ans)


(n, k) = map(int, input().split())
z = [0] * 2 ** k
for i in range(n):
	x = list(map(int, input().split()))
	s = ''
	for i in x:
		s += str(i)
	num = int(s, 2)
	z[num] += 1
if z[0]:
	print('YES')
	exit()
for i in range(2 ** k):
	for j in range(2 ** k):
		if i & j == 0:
			if z[i] and z[j]:
				print('YES')
				exit()
print('NO')


import sys
from sys import stdin, stdout

def R():
	return map(int, stdin.readline().strip().split())

def I():
	return stdin.readline().strip().split()
(n, m) = map(int, stdin.readline().strip().split())
arr = []
for i in range(n):
	arr.append(int(''.join(I()), 2))
arr = list(set(arr))
if 0 in arr:
	print('YES')
	exit()
for i in range(len(arr)):
	for j in range(i + 1, len(arr)):
		if arr[i] + arr[j] == arr[i] ^ arr[j]:
			print('YES')
			exit()
print('NO')


import sys
import re

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
(n, k) = get_ints()
myset = set()
for i in range(n):
	a = get_array()
	x = 0
	for j in range(k):
		x = 2 * x + a[j]
	myset.add(x)
for i in range(16):
	if i in myset:
		for j in range(16):
			if i & j == 0 and j in myset:
				print('YES')
				exit()
print('NO')


(n, k) = map(int, input().split())
sp = [0] * 2 ** k
for i in range(n):
	ci = list(map(int, input().split()))
	c = 0
	for j in range(k - 1, -1, -1):
		c += (1 - ci[j]) * 2 ** j
	sp[c] += 1
ed = [False] * k
for i in range(2 ** k - 1, -1, -1):
	ci = []
	t = i
	for j in range(k - 1, -1, -1):
		ci.append(t // 2 ** j)
		t %= 2 ** j
	if sp[i] > 0:
		for j in range(k):
			if ci[j] == 1:
				ed[j] = True
		break
p = i - 1
for i in range(p, -1, -1):
	ci = []
	t = i
	for j in range(k - 1, -1, -1):
		ci.append(t // 2 ** j)
		t %= 2 ** j
	if sp[i] > 0:
		for j in range(k):
			if not (ci[j] == 1 or ed[j]):
				break
		else:
			print('YES')
			exit()
if sp[2 ** k - 1] > 0:
	print('YES')
else:
	print('NO')


(n, k) = map(int, input().split())
s = set()
for x in range(n):
	s.add(int(''.join(map(str, input().split())), 2))
found = False
for i in s:
	for j in s:
		if i & j == 0 and (not found):
			print('YES')
			found = True
			break
if not found:
	print('NO')


(n, k) = list(map(int, input().split()))
a = [int(input().replace(' ', ''), 2) for i in range(n)]
from itertools import chain, combinations

def powerset(iterable):
	xs = list(iterable)
	return chain.from_iterable((combinations(xs, n) for n in range(len(xs) + 1)))
for s in powerset([x for x in range(1 << k) if x in a]):
	if len(s) == 0:
		continue
	good = True
	for i in range(k):
		c = [p >> i & 1 for p in s]
		if c.count(1) > c.count(0):
			good = False
	if good:
		print('YES')
		return
print('NO')


v = [0 for i in range(20)]
(n, m) = map(int, input().split())
for i in range(n):
	x = list(map(int, input().split()))
	sum = 0
	for j in range(m):
		sum += x[j] * (1 << j)
	v[sum] = 1
flag = 0
for i in range(16):
	for j in range(16):
		if i & j == 0 and v[i] and v[j]:
			flag = 1
if flag:
	print('YES')
else:
	print('NO')


(n, k) = map(int, input().split())
vis = [0] * 17
for _ in range(n):
	a = list(map(int, input().split()))
	vis[sum((a[i] * (1 << i) for i in range(k)))] = 1
flag = 0
for i in range(16):
	for j in range(16):
		if i & j == 0 and vis[i] and vis[j]:
			flag = 1
print('YES' if flag else 'NO')


(n, k) = map(int, input().split())
l = set()
for i in range(n):
	l.add(int(''.join(map(str, input().split())), 2))
for x in l:
	for y in l:
		if x & y == 0:
			print('YES')
			exit()
print('NO')


Read = lambda : map(int, input().split())
(n, m) = Read()
s = set()
for i in range(n):
	s.add(int(''.join(map(str, input().split())), 2))
for i in s:
	for j in s:
		if i & j == 0:
			print('Yes')
			exit()
print('No')


[n, k] = list(map(int, input().split()))
prob = list()
for _ in range(n):
	prob.append(list(map(int, input().split())))
mask = list()
for p in prob:
	x = 0
	y = 0
	for i in range(k):
		if p[i] == 1:
			x |= 1 << i
	mask.append(x)
mask.sort()
for x in mask:
	if x == 0:
		print('YES')
		exit(0)
import bisect
for x in mask:
	for y in range(1 << k):
		if x & y == 0:
			idx = bisect.bisect_left(mask, y)
			if idx < n and mask[idx] == y:
				print('YES')
				exit(0)
print('NO')


(n, k) = map(int, input().split())
cnt = [0] * (1 << k)
for _ in range(n):
	arr = list(map(int, input().split()))
	acc = 0
	for i in range(k):
		acc |= arr[i] * (1 << i)
	cnt[acc] += 1
gud = cnt[0] > 0
for i in range(1 << k):
	for j in range(i + 1, 1 << k):
		if i & j > 0:
			continue
		if cnt[i] > 0 and cnt[j] > 0:
			gud = True
if gud:
	print('YES')
else:
	print('NO')


inp = map(int, input().split())
(n, k) = inp
a = [list(map(int, input().split())) for _ in range(n)]
found = [False] * (1 << k)
done = False
for i in a:
	val = 0
	for j in i:
		val *= 2
		val += j
	if val == 0:
		done = True
	for j in range(len(found)):
		if j & val == 0 and found[j]:
			done = True
	found[val] = True
print('Yes' if done else 'No')


(n, k) = map(int, input().split())
temp = set()
for i in range(n):
	temp.add(input())
f = 0
for r in temp:
	for r2 in temp:
		(a, b) = (list(map(int, r.split())), list(map(int, r2.split())))
		c = 0
		for i in range(k):
			c += int(a[i] + b[i] != 2)
		if c == k:
			f = 1
if f:
	print('YES')
else:
	print('NO')


from collections import defaultdict
One = {0: [1], 1: [0]}
Two = {0: [1, 2, 3], 1: [0, 2], 2: [0, 1], 3: [0]}
Three = {0: [1, 2, 3, 4, 5, 6, 7], 1: [0, 2, 4, 6], 2: [0, 1, 4, 5], 3: [0, 4], 4: [0, 1, 2, 3], 5: [0, 2], 6: [0, 1], 7: [0]}
Four = {0: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], 1: [0, 2, 4, 6, 8, 10, 12, 14], 2: [0, 1, 4, 5, 8, 9, 12, 13], 3: [0, 4, 8, 12], 4: [0, 1, 2, 3, 8, 9, 10, 11], 5: [0, 2, 8, 10], 6: [0, 1, 8, 9], 7: [0, 8], 8: [0, 1, 2, 3, 4, 5, 6, 7], 9: [0, 2, 4, 6], 10: [0, 1, 4, 5], 11: [0, 4], 12: [0, 1, 2, 3], 13: [0, 2], 14: [0, 1], 15: [0]}
(n, k) = map(int, input().split())
List = []
for i in range(n):
	temp = ''.join([x for x in input().split()])
	List.append(int(temp, 2))
Dict = defaultdict(int)
if n == 1:
	if List[0]:
		print('NO')
	else:
		print('YES')
	exit()
for i in List:
	Dict[i] += 1
if Dict[0] > 1:
	print('YES')
else:
	flag = 0
	if k == 4:
		for i in range(n):
			if List[i]:
				for j in Four[List[i]]:
					if Dict[j]:
						print('YES')
						flag = 1
						break
			if flag:
				break
		if not flag:
			print('NO')
	elif k == 3:
		for i in range(n):
			if List[i]:
				for j in Three[List[i]]:
					if Dict[j]:
						print('YES')
						flag = 1
						break
			if flag:
				break
		if not flag:
			print('NO')
	elif k == 2:
		for i in range(n):
			if List[i]:
				for j in Two[List[i]]:
					if Dict[j]:
						print('YES')
						flag = 1
						break
			if flag:
				break
		if not flag:
			print('NO')
	else:
		for i in range(n):
			if List[i]:
				for j in One[List[i]]:
					if Dict[j]:
						print('YES')
						flag = 1
						break
			if flag:
				break
		if not flag:
			print('NO')


def flip(x):
	return any((bin(i)[2:] in s for i in range(2 << k) if not i & x))
(n, k) = map(int, input().split())
s = set()
for _ in range(n):
	x = input().replace(' ', '')
	if flip(int(x, 2)) or x == '0' * k:
		exit(print('YES'))
	s.add(x.lstrip('0'))
print('NO')


(n, k) = map(int, input().split())
exist = [False] * 16
zero = [False] * 4
for i in range(n):
	part = list(map(int, input().split()))
	P = [0] * (4 - k)
	for elem in part:
		P.append(elem)
	num = 0
	for j in range(4):
		if P[j] == 0:
			zero[j] = True
	for j in range(4):
		if P[3 - j] == 1:
			num += 2 ** j
	exist[num] = True
ans = False
if exist[0] or (exist[1] and zero[3]) or (exist[2] and zero[2]) or (exist[4] and zero[1]) or (exist[8] and zero[0]) or (exist[3] and exist[12]) or (exist[5] and exist[10]) or (exist[6] and exist[9]):
	ans = True
if ans:
	print('YES')
else:
	print('NO')


(n, k) = [int(z) for z in input().split()]
ans = [0] * 16
for i in range(n):
	problem = [int(z) for z in input().split()]
	s = 0
	for j in range(k):
		s = s * 2 + problem[j]
	ans[s] += 1
for i in range(16):
	for j in range(16):
		if ans[i] > 0 and ans[j] > 0 and (i & j == 0):
			print('YES')
			exit(0)
print('NO')


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 15
mod = 10 ** 9 + 7

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def main():
	(n, k) = LI()
	s = set()
	for _ in range(n):
		t = LI()
		c = sum(t)
		if c == 0:
			return 'YES'
		s.add(tuple(t))
	l = list(s)
	ll = len(s)
	for i in range(ll):
		for j in range(i + 1, ll):
			f = True
			for li in range(k):
				if l[i][li] == 1 and l[j][li] == 1:
					f = False
					break
			if f:
				return 'YES'
	return 'NO'
print(main())


def main():
	(m, k) = map(int, input().split())
	all = set()
	zeros = ''
	for _ in range(k):
		zeros += '0'
	for _ in range(m):
		line = input().replace(' ', '')
		if line == zeros:
			print('YES')
			return
		all.add(line)
	for s1 in all:
		for s2 in all:
			if s1 == s2:
				continue
			bad = False
			for i in range(0, len(s1)):
				if s1[i] == '1' and s2[i] == '1':
					bad = True
			if not bad:
				print('YES')
				return
	print('NO')
main()


(n, k) = map(int, input().split())
s = set()
for i in range(n):
	s.add(int(''.join(map(str, input().split())), 2))
for i in s:
	for j in s:
		if i & j == 0:
			print('YES')
			exit()
print('NO')


from bisect import bisect_left as bl, bisect_right as br, insort
import sys
import heapq
from math import *
from collections import defaultdict as dd, deque

def data():
	return sys.stdin.readline().strip()

def mdata():
	return map(int, data().split())
(n, k) = mdata()
s = set()
for i in range(n):
	s.add(int(''.join(input().split()), 2))
for i in s:
	for j in s:
		if i & j == 0:
			print('YES')
			exit()
print('NO')


import sys

def ReadInput():
	return sys.stdin.read().splitlines()

def GetIA(s, delim=' '):
	return [int(x) for x in s.split(delim)]

def GetKey(flags):
	key = 0
	for a in flags:
		key <<= 1
		key += a
	return key

def main():
	input = ReadInput()
	seen = dict()
	for s in input[1:]:
		seen[GetKey(GetIA(s))] = True
	for a in seen.keys():
		for b in seen.keys():
			if a & b == 0:
				print('YES')
				return
	print('NO')
main()


import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
import collections
from itertools import permutations
from collections import defaultdict
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
(n, k) = map(int, input().split())
a = list()
for i in range(n):
	b = list(map(int, input().split()))
	a.append((sum(b), *b))
a.sort()
if n == 1:
	if a[0][0] == 0:
		print('YES')
	else:
		print('NO')
else:
	p = [0] * k
	ch = list(a[0][1:])
	ct = 0
	if sum(ch) == 0:
		ct = 1
	for i in range(1, n):
		curr = 0
		for j in range(k):
			if ch[j] + a[i][j + 1] >= 2:
				curr = 1
				break
		if curr == 0:
			ct = 1
			break
	a.sort(reverse=True)
	p = [0] * k
	ch = list(a[0][1:])
	if sum(ch) == 0:
		ct = 1
	for i in range(1, n):
		curr = 0
		for j in range(k):
			if ch[j] + a[i][j + 1] >= 2:
				curr = 1
				break
		if curr == 0:
			ct = 1
			break
	if ct == 1:
		print('YES')
	else:
		print('NO')


inp = input().split(' ')
n = int(inp[0])
k = int(inp[1])
s = set()
for i in range(n):
	a = input().split(' ')
	x = 0
	for j in range(k):
		x = 2 * x + int(a[j])
	s.add(x)
for i in range(16):
	if i in s:
		for j in range(16):
			if j in s:
				if i & j == 0:
					print('YES')
					exit(0)
print('NO')


from sys import stdin, stdout
(n, k) = map(int, stdin.readline().split())
used = {}
sze = 2 ** k
for i in range(n):
	values = list(map(int, stdin.readline().split()))
	if ''.join(list(map(str, values))) in used:
		used[''.join(list(map(str, values)))] += 1
	else:
		used[''.join(list(map(str, values)))] = 1
label = 0
if '0' * k in used and used['0' * k]:
	label = 1
for i in range(sze):
	for j in range(sze):
		a = bin(i)[2:]
		b = bin(j)[2:]
		a = '0' * (k - len(a)) + a
		b = '0' * (k - len(b)) + b
		if a in used and b in used and (a != b or used[a] > 1):
			result = [0 for i in range(k)]
			for z in range(k):
				result[z] += int(a[z])
				result[z] += int(b[z])
			if max(result) <= 1:
				label = 1
if label:
	stdout.write('YES')
else:
	stdout.write('NO')


(n, k) = map(int, input().split())
l = [0] * 100
for i in range(n):
	l[int(''.join(input().split()), 2)] = 1
for i in range(16):
	for j in range(16):
		if l[i] and l[j] and (i & j == 0):
			print('YES')
			exit(0)
print('NO')


(n, k) = [int(i) for i in input().split()]
if k == 1:
	alert = 0
	for time in range(n):
		term = str(input())
		if term == '0':
			alert = 1
			break
	print('NO') if alert == 0 else print('YES')
elif k == 2:
	(s1, s2) = (0, 0)
	for time in range(n):
		term = str(input())
		if term == '0 0':
			(s1, s2) = (1, 1)
			break
		elif term == '0 1':
			s1 = 1
		elif term == '1 0':
			s2 = 1
		if (s1, s2) == (1, 1):
			break
	print('YES') if (s1, s2) == (1, 1) else print('NO')
elif k == 3:
	alert = 0
	s = {str(input()) for i in range(n)}
	if '0 0 0' in s:
		alert = 1
	if '0 0 1' in s:
		if '1 1 0' in s or '1 0 0' in s or '0 1 0' in s:
			alert = 1
	if '0 1 0' in s:
		if '1 0 1' in s or '1 0 0' in s or '0 0 1' in s:
			alert = 1
	if '1 0 0' in s:
		if '0 0 1' in s or '0 1 0' in s or '0 1 1' in s:
			alert = 1
	print('YES') if alert == 1 else print('NO')
elif k == 4:
	alert = 0
	s = {str(input()) for i in range(n)}
	s = list(s)
	if '0 0 0 0' in s:
		alert = 1
	if '1 1 0 0' in s:
		for i in range(len(s)):
			if s[i][0] == '0' and s[i][2] == '0':
				alert = 1
	if '1 0 1 0' in s:
		for i in range(len(s)):
			if s[i][0] == '0' and s[i][4] == '0':
				alert = 1
	if '1 0 0 1' in s:
		for i in range(len(s)):
			if s[i][0] == '0' and s[i][6] == '0':
				alert = 1
	if '0 1 1 0' in s:
		for i in range(len(s)):
			if s[i][2] == '0' and s[i][4] == '0':
				alert = 1
	if '0 1 0 1' in s:
		for i in range(len(s)):
			if s[i][2] == '0' and s[i][6] == '0':
				alert = 1
	if '0 0 1 1' in s:
		for i in range(len(s)):
			if s[i][4] == '0' and s[i][6] == '0':
				alert = 1
	if '1 0 0 0' in s:
		for i in range(len(s)):
			if s[i][0] == '0':
				alert = 1
	if '0 1 0 0' in s:
		for i in range(len(s)):
			if s[i][2] == '0':
				alert = 1
	if '0 0 1 0' in s:
		for i in range(len(s)):
			if s[i][4] == '0':
				alert = 1
	if '0 0 0 1' in s:
		for i in range(len(s)):
			if s[i][6] == '0':
				alert = 1
	print('YES') if alert == 1 else print('NO')


(problems, teams) = [int(x) for x in input().split()]
teams1 = [0 for x in range(teams)]
known = set()
for i in range(problems):
	questions = ''.join(input().split())
	known.add(int(questions, 2))
known = sorted(known)
z = len(known)
for i in range(z):
	for j in range(i, z):
		if known[i] & known[j] == 0:
			print('YES')
			exit()
print('NO')


def main():
	arr = input().split()
	count = int(arr[0])
	teams = int(arr[1])
	arr = [False for x in range(2 ** teams)]
	arr[0] = True
	bo = False
	for x in range(count):
		string = input().split()
		store = 0
		for y in range(teams):
			if string[y] == '0':
				store += 2 ** y
		sub = False
		for y in range(2 ** teams):
			if y | store == 2 ** teams - 1 and arr[y]:
				sub = True
				break
		if sub == True:
			bo = True
			break
		else:
			arr[store] = True
	if bo:
		print('Yes')
	else:
		print('No')
main()


vis = [0] * ((1 << 4) + 5)
line = input().split()
n = int(line[0])
k = int(line[1])
for i in range(n):
	line = input().split()
	st = 0
	for j in range(k):
		x = int(line[j])
		st += (1 << j) * x
	vis[st] = 1
flag = False
for i in range(16):
	for j in range(16):
		if vis[i] == 0 or vis[j] == 0:
			continue
		if i & j == 0:
			flag = True
			break
	if flag:
		break
if flag:
	print('YES')
else:
	print('NO')


import math
import collections
import bisect
import heapq
import time
import random
(N, K) = map(int, input().split())
problems = collections.defaultdict(set)
for i in range(N):
	row = tuple([int(x) for x in input().split()])
	k = sum(row)
	if k == 0:
		print('YES')
		exit(0)
	elif k < K:
		for i in range(K):
			if row[i] == 0:
				problems[i].add(row)
if not problems:
	print('NO')
	exit(0)
for p1 in problems[0]:
	idx = [i for i in range(K) if p1[i] == 1]
	if not idx:
		print('YES')
		exit(0)
	p2s = problems[idx[0]]
	for p2 in p2s:
		if all((p2[i] == 0 for i in idx)):
			print('YES')
			exit(0)
print('NO')


(n, k) = map(int, input().split())
a = set()
yes = False
for i in range(n):
	a.add(input())
for w1 in a:
	for w2 in a:
		x = list(map(int, w1.split()))
		y = list(map(int, w2.split()))
		count = 0
		for i in range(k):
			if x[i] + y[i] != 2:
				count += 1
		if count == k:
			yes = True
if yes:
	print('YES')
else:
	print('NO')


def test(masks, wanted):
	for w in wanted:
		if w not in masks:
			return False
	return True

def any_test(masks, tests):
	for t in tests:
		if test(masks, t):
			return True
	return False

def inflate(perm):
	count = max(perm)
	masks = [[0 for i in range(len(perm))] for j in range(count)]
	for i in range(len(perm)):
		if perm[i] == 0:
			continue
		masks[perm[i] - 1][i] = 1
	return [tuple(m) for m in masks]

def gen(st, lev, teams, tests):
	if lev >= teams:
		if max(st) > 1:
			tests.append(inflate(st))
		return
	for i in range(teams + 1):
		st[lev] = i
		gen(st, lev + 1, teams, tests)

def gen_tests(teams):
	tests = []
	st = [0 for i in range(teams)]
	gen(st, 0, teams, tests)
	return tests

def back(masks, teams):
	tests = gen_tests(teams)
	return any_test(masks, tests)

def main():
	(probs, teams) = list(map(int, input().split()))
	masks = set()
	for i in range(probs):
		conf = tuple(list(map(int, input().split())))
		if 1 not in conf:
			print('YES')
			return
		masks.add(conf)
	if teams == 1:
		print('NO')
		return
	if teams == 2:
		good = test(masks, [(0, 1), (1, 0)])
	else:
		good = back(masks, teams)
	print('YES' if good else 'NO')
main()


ii = lambda : int(input())
kk = lambda : map(int, input().split())
ll = lambda : list(kk())
(n, k) = kk()
ls = [False] * 16
for _ in range(n):
	x = 0
	for v in kk():
		x = x * 2 + v
	ls[x] = True
if ls[0]:
	print('yes')
	exit()
for i in range(1, 16):
	if ls[i]:
		for j in range(i + 1, 16):
			if ls[j] and i & j == 0:
				print('yes')
				exit()
print('no')


from sys import stdin
input = stdin.readline
import math
import sys
from collections import defaultdict
sys.setrecursionlimit(10 ** 4)

def get_all(string, index, temp, aux):
	if index == len(string):
		return aux.append(''.join(temp))
	if string[index] == '1':
		temp.append('1')
		get_all(string, index + 1, temp, aux)
		temp.pop()
		temp.append('0')
		get_all(string, index + 1, temp, aux)
		temp.pop()
	else:
		temp.append('0')
		get_all(string, index + 1, temp, aux)
		temp.pop()

def counter(string):
	temp = []
	for i in string:
		if i == '0':
			temp.append('1')
		else:
			temp.append('0')
	aux = []
	get_all(temp, 0, [], aux)
	return aux
(n, k) = list(map(int, input().split()))
num = set()
for _ in range(n):
	temp = list(input().split())
	num.add(''.join(temp))
if '0' * k in num:
	print('YES')
	exit()
for i in num:
	a = counter(i)
	for j in a:
		if j in num:
			print('YES')
			exit()
else:
	print('NO')


from sys import exit
(n, k) = [int(i) for i in input().split()]
s = set([int(''.join(input().split()), base=2) for j in range(n)])
for t in s:
	for m in range(1 << k):
		if m in s:
			for i in range(k):
				if t >> i & 1 and m >> i & 1:
					break
			else:
				print('YES')
				exit(0)
print('NO')


(n, k) = list(map(int, input().strip().split()))
array = [0] * 2 ** k
for _ in range(n):
	t = int(''.join(input().strip().split()), 2)
	array[t] += 1
comp = [[] for i in range(2 ** k)]
for i in range(2 ** k):
	for j in range(2 ** k):
		if i & j == 0:
			comp[i].append(j)
flag = False
if array[0] > 0:
	print('YES')
	flag = True
for i in range(1, 2 ** k):
	if flag:
		break
	if array[i] > 0:
		for j in comp[i]:
			if array[j] > 0:
				print('YES')
				flag = True
				break
if not flag:
	print('NO')