#include using namespace std; #include using namespace atcoder; #define rep(i, n) for(int i=0;i<(n);++i) #define rep1(i, n) for(int i=1;i<=(n);i++) #define ll long long using mint = modint998244353; using P = pair; using lb = long double; using T = tuple; #ifdef LOCAL # include # define dbg(...) debug_print::multi_print(#__VA_ARGS__, __VA_ARGS__) #else # define dbg(...) (static_cast(0)) #endif int main() { int n, m; cin >> n >> m; dsu uf(n); vector> g(n); vector> e; two_sat ts(n); rep(i,m){ int a, b; string s; cin >> a >> s >> b; --a;--b; if(s=="<==>"){ ts.add_clause(a, 0, b, 1); ts.add_clause(a, 1, b, 0); } else{ ts.add_clause(a, 1, b, 1); ts.add_clause(a, 0, b, 0); } } bool f = ts.satisfiable(); if(f){ cout << "Yes" << endl; auto vs = ts.answer(); int s = accumulate(vs.begin(),vs.end(),0); vector ans; if(s>=(n+1)/2){ rep(i,n) if(vs[i]) ans.push_back(i); } else{ rep(i,n) if(!vs[i]) ans.push_back(i); } cout << ans.size() << endl; rep(i,ans.size()){ cout << ans[i]+1; if(i==ans.size()-1) cout << endl; else cout << " "; } } else{ cout << "No" << endl; } return 0; }