from collections import deque N, M = map(int, input().split()) G = [[] for _ in range(N)] for _ in range(M): u, E, v = input().split() u, v = int(u)-1, int(v)-1 if E == "<==>": G[u].append((v, 0)) G[v].append((u, 0)) else: G[u].append((v, 1)) G[v].append((u, 1)) visited = [-1]*N ans = [] for i in range(N): if visited[i] == -1: visited[i] = 0 que = deque() que.append(i) zero = [i] one = [] while que: n = que.popleft() for v, c in G[n]: if visited[v] == -1: visited[v] = (visited[n]+c)%2 que.append(v) if visited[v] == 0: zero.append(v) else: one.append(v) elif visited[v] != (visited[n]+c)%2: exit(print("No")) if len(zero) >= len(one): ans += zero else: ans += one print("Yes") print(len(ans)) print(*[i+1 for i in sorted(ans)])