#include using namespace std; void fast_io() { ios::sync_with_stdio(false); std::cin.tie(nullptr); } int main() { fast_io(); int n, m; cin >> n >> m; vector>> g(n); for (int i = 0; i < m; i++) { int u, v; string e; cin >> u >> e >> v; u--; v--; if (e.size() == 5) { g[u].push_back({v, 1}); g[v].push_back({u, 1}); } else { g[u].push_back({v, 0}); g[v].push_back({u, 0}); } } vector color(n, -1); vector vis(n, false); vector ans; for (int i = 0; i < n; i++) { if (vis[i]) { continue; } vis[i] = true; queue q; q.push(i); color[i] = 0; vector> verts(2); verts[0].push_back(i); while (!q.empty()) { int u = q.front(); q.pop(); for (auto [v, e] : g[u]) { if (color[v] == -1) { color[v] = color[u] ^ e; vis[v] = true; verts[color[v]].push_back(v); q.push(v); } else if (color[v] != color[u] ^ e) { cout << "No" << endl; return 0; } } } if (verts[0].size() < verts[1].size()) { swap(verts[0], verts[1]); } for (auto v : verts[0]) { ans.push_back(v); } } if (ans.size() >= (n + 1) / 2) { cout << "Yes" << endl; cout << ans.size() << endl; sort(ans.begin(), ans.end()); for (int i = 0; i < ans.size(); i++) { cout << ans[i] + 1 << " "; } cout << endl; } else { cout << "No" << endl; } }