n = int(input()) assert 0 <= n <= 10 t = [] m = int(input()) assert 0 <= m <= 10 for _ in range(m): k = int(input()) assert k > 0 a = list(map(int, input().split())) assert k == len(a) for i in range(1, k): assert a[i - 1] < a[i] assert a[0] >= 0 assert a[-1] < n t.append(a) ans = False for i in range(n): for j in range(i): ch = True for k in t: c = 0 for x in k: if x in [i, j]: c += 1 ch &= c != 1 ans |= ch print("YNeos"[ans::2])