#include #include #include #include using namespace std; using ll=long long; #define rep(i,n) for(int i=0;i=0;i--) #define all(v) v.begin(),v.end() #define rall(v) v.rbegin(),v.rend() template bool chmax(T &a, T b){if (a < b){a = b;return true;} else return false;} template bool chmin(T &a, T b){if (a > b){a = b;return true;} else return false;} struct UnionFind { vector par, siz; UnionFind(int n) : par(n,-1), siz(n,1) {} int find(int x){ if (par[x] == -1) return x; else{ par[x] = find(par[x]); return par[x]; } } bool same(int x, int y){ return find(x) == find(y); } int size(int x){ return siz[find(x)]; } void merge(int x, int y){ x = find(x); y = find(y); if (x == y) return; if (siz[x] < siz[y]) swap(x,y); siz[x] += siz[y]; par[y] = x; } }; void dfs(int x,int p,vector>>&g,vector&ans){ for(auto[i,e,k]:g[x]){ if(i==p)continue; dfs(i,x,g,ans); if(k==1)ans[e]="<-"; else ans[e]="->"; } } int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); int n; cin>>n; vector>>g(n); UnionFind uf(n); int s=-1,t=-1; vectorans(n); rep(i,n){ int a,b; cin>>a>>b; a--; b--; if(uf.same(a,b)){ s=a; t=b; ans[i]="->"; }else{ uf.merge(a,b); g[a].push_back(make_tuple(b,i,1)); g[b].push_back(make_tuple(a,i,0)); } } dfs(s,-1,g,ans); rep(i,n)cout<