#include #include using namespace std; using namespace atcoder; using ll=long long; using ld=long double; ld pie=3.141592653589793; ll inf=14449999999999; ll mod=998244353; int main(){ ll n; cin >> n; vector>g(n); vectorx(n),y(n); set>s; for (ll i = 0; i < n; i++) { ll a,b; cin >> a >> b; a--,b--; g[a].push_back(b); g[b].push_back(a); x[i]=a; y[i]=b; } vectormemo(n); for (ll i = 0; i < n; i++) { memo[i]=g[i].size(); s.insert({memo[i],i}); } vectorm(n,0); map,ll>mp; while (!s.empty()) { auto v=s.lower_bound({-inf,1}); pairp=*(v); m[p.second]=1; s.erase(p); m[p.second]=1; for (ll i = 0; i < g[p.second].size(); i++) { if (m[g[p.second][i]]==0&&memo[g[p.second][i]]>1) { mp[{p.second,g[p.second][i]}]=1; s.erase({memo[g[p.second][i]],g[p.second][i]}); memo[g[p.second][i]]-=1; s.insert({memo[g[p.second][i]],g[p.second][i]}); break; } } } for (ll i = 0; i < n; i++) { if (mp[{x[i],y[i]}]==1) { cout << "->" << endl; }else{ cout << "<-" << endl; } } }