import sys sys.setrecursionlimit(5*10**5) input = sys.stdin.readline from collections import defaultdict, deque, Counter from heapq import heappop, heappush from bisect import bisect_left, bisect_right from math import gcd from collections import defaultdict n,m = map(int,input().split()) graph = [[] for i in range(n+1)] for i in range(m): u, e, v = map(str,input().split()) u = int(u) v = int(v) if e == "<=/=>": graph[u].append((v,1)) graph[v].append((u,1)) else: graph[u].append((v,0)) graph[v].append((u,0)) depth = [-1]*(n+1) def bfs(s, n): que = deque([s]) depth[s] = 0 ok = 1 ss = set() while que: crr = que.popleft() ss.add(crr) for nxt,w in graph[crr]: if depth[nxt] == -1: depth[nxt] = depth[crr]^w que.append(nxt) else: if depth[nxt] != depth[crr]^w: ok = 0 return ok, ss big = [] ok = 1 for i in range(1, n+1): if depth[i] != -1: continue oki, s = bfs(1, n) ok &= oki o = [] z = [] for j in s: if depth[j] == 1: o.append(j) elif depth[j] == 0: z.append(j) if len(o) > len(z): big += o else: big += z if not ok: print('No') else: no = [] for i in range(1, n+1): if depth[i] == -1: big.append(i) print('Yes') big.sort() print(len(big)) print(*big)