#include using namespace std; int main() { int N, M; cin >> N >> M; vector> G1(N); vector> G2; 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.push_back(make_pair(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 (pair p : G2) { if (root[p.first] == root[p.second]) { ans = false; } } if (!ans) { cout << "No" << endl; } else { vector> G3(N); for (pair p : G2) { int a = root[p.first], b = root[p.second]; G3[a].push_back(b); G3[b].push_back(a); } vector state(N, -1); for (int i = 0; i < N; i++) { if (root[i] == i && state[i] == -1) { state[i] = 0; queue> Q; Q.push(make_pair(i, 0)); while (!Q.empty()) { int now = Q.front().first; int st = Q.front().second; Q.pop(); for (int nxt : G3[now]) { if (state[nxt] == -1) { state[nxt] = 1 - st; Q.push(make_pair(nxt, 1 - st)); } } } } else if (root[i] != i) { state[i] = state[root[i]]; } } cout << "Yes" << endl; int a = accumulate(state.begin(), state.end(), 0); vector out; for (int i = 0; i < N; i++) { if ((a * 2 >= N && state[i] == 1) || (a * 2 < N && state[i] == 0)) { out.push_back(i + 1); } } cout << out.size() << endl; for (int i = 0; i < (int)out.size(); i++) { cout << out[i] << ' '; } cout << endl; } }