#include using namespace std; using ll=long long; using P=pair; int main(){ ll n,m; cin>>n>>m; vector> G(n); for(ll i=0;i>u>>e>>v; u--; v--; if(e=="<==>"){ G[u].push_back(P(v,1)); G[v].push_back(P(u,1)); }else{ G[u].push_back(P(v,0)); G[v].push_back(P(u,0)); } } ll cnt=0; vector ans; vector seen(n,false); queue que; for(ll i=0;i> dp(n,vector(2,-1e18)); dp[i][0]=0; dp[i][1]=1; while(que.size()){ ll q=que.front(); que.pop(); for(P p:G[q]){ ll u=p.first; ll idx=p.second; if(!seen[u]){ seen[u]=true; if(idx==1){ dp[u][0]=max(dp[u][0],dp[q][0]); dp[u][1]=max(dp[u][1],dp[q][1]+1); }else{ dp[u][0]=max(dp[u][0],dp[q][1]); dp[u][1]=max(dp[u][1],dp[q][0]+1); } } } } ll tmp=-1e18; ll last,kind; for(ll i=0;i seen2(n,false); seen2[last]=true; queue

que2; que2.push(P(last,kind)); if(kind==1){ ans.push_back(last); } while(que2.size()){ P q=que2.front(); que2.pop(); ll ver=q.first; ll kind=q.second; for(P p:G[ver]){ ll u=p.first; if(!seen2[u]){ if(dp[u][0]+1==dp[ver][kind]){ seen2[u]=true; que2.push(P(u,0)); if(kind==1){ ans.push_back(u); } }else if(dp[u][1]+1==dp[ver][kind]){ seen2[u]=true; que2.push(P(u,1)); if(kind==1){ ans.push_back(u); } } } } } } } sort(ans.begin(),ans.end()); ans.erase(unique(ans.begin(),ans.end()),ans.end()); if(ans.size()<(n+1)/2){ cout<<"No"<