#include #include using namespace atcoder; using namespace std; int main() { int n,m; cin>>n>>m; vector> g(2*n); dsu d(2*n); for (int i=0;i>a>>s>>b; a--; b--; if (s=="<==>") { g[a+n].push_back(b+n); g[b+n].push_back(a+n); g[a].push_back(b); g[b].push_back(a); d.merge(a,b); d.merge(a+n,b+n); } else { g[a+n].push_back(b); g[b].push_back(a+n); g[b+n].push_back(a); g[a].push_back(b+n); d.merge(a,b+n); d.merge(b,a+n); } } for (int i=0;i seen(2*n,false),seen2(2*n,false); set ans,ans2; for (int i=0;i q; seen[i]=true; ans.insert(i); q.push(i); while(!q.empty()) { int v=q.front(); q.pop(); for (auto x:g[v]) { if (seen[x]) continue; if (x q; seen2[i]=true; q.push(i); while(!q.empty()) { int v=q.front(); q.pop(); for (auto x:g[v]) { if (seen2[x]) continue; if (x=(n+1)/2) { cout<