#include using namespace std; int main() { int N, M; cin >> N >> M; vector> G1(N), G2(N); for (int i = 0; i < M; i++) { int a, b; string s; cin >> a >> s >> b; a--; b--; if (s == "<==>") { G1[a].push_back(b); G1[b].push_back(a); } else { G2[min(a, b)].push_back(max(a, b)); } } vector root(N, -1); for (int i = 0; i < N; i++) { if (root[i] == -1) { root[i] = i; queue Q; Q.push(i); while (!Q.empty()) { int now = Q.front(); Q.pop(); for (int nxt : G1[now]) { if (root[nxt] == -1) { root[nxt] = i; Q.push(nxt); } } } } } bool ans = true; for (int i = 0; i < N; i++) { for (int j : G2[i]) { if (root[i] == root[j]) { ans = false; } } } if (!ans) { cout << "No" << endl; } else { cout << "Yes" << endl; vector state(N, -1); for (int i = 0; i < N; i++) { if (root[i] == i) { if (state[i] == -1) { if (G1[i].size() > 0 && state[G1[i].front()] == 1) { state[i] = 0; } else { state[i] = 1; } } for (int j : G2[i]) { state[root[j]] = 1 - state[i]; } } else { state[i] = state[root[i]]; } } int cnt = 0; for (int i = 0; i < N; i++) { if (state[i] == 1) { cnt++; } } cout << cnt << endl; for (int i = 0; i < N; i++) { if (state[i] == 1) { cout << i + 1 << ' '; } } cout << endl; } }