#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
int main () {
	int N, M;
	cin >> N >> M;
	two_sat T(N);
	while (M--) {
		int a, b;
		string s;
		cin >> a >> s >> b;
		a --; b --;
		bool x = s == "<==>";
		T.add_clause(a, true, b, !x);
		T.add_clause(a, false, b, x);
	}
	bool ok = T.satisfiable();
	if (!ok) {
		cout << "No" << endl;
	} else {
		cout << "Yes" << endl;
		auto V = T.answer();
		int s = 0;
		for (auto b : V) {
			s += b;
		}
		bool tt = s * 2 >= N;
		cout << max(s, N - s) << endl;
		std::vector<int> A;
		for (int i = 0; i < N; i ++) {
			if (V[i] == tt) {
				A.push_back(i + 1);
			}
		}
		for (auto a : A) {
			cout << a << (a == A.back() ? "" : " ");
		}
		cout << endl;
	}
}