using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static int[] NList => ReadLine().Split().Select(int.Parse).ToArray(); static string[] SList(long n) => Enumerable.Repeat(0, (int)n).Select(_ => ReadLine()).ToArray(); public static void Main() { Solve(); } static void Solve() { var c = NList; var (n, m) = (c[0], c[1]); var order = SList(m); var tree = new List<(int to, int xor)>[n]; for (var i = 0; i < tree.Length; ++i) tree[i] = new List<(int to, int xor)>(); foreach (var o in order) { var s = o.Split(); var i = int.Parse(s[0]) - 1; var j = int.Parse(s[2]) - 1; var xor = s[1] == "<==>" ? 0 : 1; tree[i].Add((j, xor)); tree[j].Add((i, xor)); } var color = Enumerable.Repeat(-1, n).ToArray(); for (var i = 0; i < n; ++i) { if (color[i] < 0) { var dic = new Dictionary(); dic[i] = 0; if (!DFS(i, tree, dic)) { WriteLine("No"); return; } var zeros = dic.Count(kv => kv.Value == 0); if (zeros * 2 < dic.Count()) { foreach (var kv in dic) color[kv.Key] = kv.Value ^ 1; } else { foreach (var kv in dic) color[kv.Key] = kv.Value; } } } var list = new List(); for (var i = 0; i < n; ++i) if (color[i] == 0) list.Add(i + 1); WriteLine("Yes"); WriteLine(list.Count); WriteLine(string.Join(" ", list)); } static bool DFS(int cur, List<(int to, int xor)>[] tree, Dictionary dic) { var color = dic[cur]; foreach (var next in tree[cur]) { if (dic.ContainsKey(next.to)) { if (dic[next.to] != (color ^ next.xor)) return false; } else { dic[next.to] = color ^ next.xor; if (!DFS(next.to, tree, dic)) return false; } } return true; } }