#include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; #define rep(i, n) for(int i = 0; i < (n); i++) template using vi = vector; template using vii = vector>; template using viii = vector>; using P = pair; void chmin(ll & x, ll y) { x = min(x, y); } void chmax(ll& x, ll y) { x = max(x, y); } struct edge { int to, idx; }; int main() { int n; cin >> n; vi a(n), b(n); vii to(n); vi deg(n); rep(i, n) { cin >> a[i] >> b[i]; a[i]--, b[i]--; to[a[i]].push_back({ b[i], i }); to[b[i]].push_back({ a[i], i + n }); deg[a[i]]++, deg[b[i]]++; } queue q; rep(i, n) { if (deg[i] == 1) q.push(i); } vi ans(n); vi visited(n); while (!q.empty()) { int v = q.front(); q.pop(); visited[v] = true; edge nv = to[v].front(); if (nv.idx >= n) ans[nv.idx - n] = 1; else ans[nv.idx] = -1; deg[nv.to]--; if (deg[nv.to] == 1) q.push(nv.to); } rep(i, n) { if (visited[i]) continue; q.push(i); while (!q.empty()) { int v = q.front(); q.pop(); visited[v] = true; for (edge nv : to[v]) { int num = nv.idx; if (num >= n) num -= n; if (ans[num]) continue; if (nv.idx >= n) ans[nv.idx - n] = 1; else ans[nv.idx] = -1; q.push(nv.to); break; } } } rep(i, n) cout << (ans[i] == 1 ? "<-" : "->") << endl; return 0; }