#include using namespace std; void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); } int main() { fast_io(); int n; cin >> n; map, int> idx; vector> g(n); for (int i = 0; i < n; i++) { int a, b; cin >> a >> b; a--, b--; idx[{a, b}] = i; idx[{b, a}] = i; g[a].push_back(b); g[b].push_back(a); } vector loop; { vector color(n, 0); vector parent(n, -1); function dfs = [&](int v, int p) { color[v] = 1; for (int u : g[v]) { if (u == p) { continue; } if (color[u] == 0) { parent[u] = v; dfs(u, v); } else if (color[u] == 1) { int cur = v; while (cur != u) { loop.push_back(cur); cur = parent[cur]; } loop.push_back(u); } } color[v] = 2; }; dfs(0, -1); } vector vis(n), ans(n); deque dq; int l = loop.size(); for (int i = 0; i < l; i++) { dq.push_back(loop[i]); vis[loop[i]] = 1; int j = loop[i], k = loop[(i + 1) % l]; if (j < k) { ans[idx[{j, k}]] = true; } else { ans[idx[{k, j}]] = false; } } while (!dq.empty()) { int v = dq.front(); dq.pop_front(); for (int u : g[v]) { if (!vis[u]) { vis[u] = 1; dq.push_back(u); if (v < u) { ans[idx[{v, u}]] = false; } else { ans[idx[{u, v}]] = true; } } } } for (int i = 0; i < n; i++) { if (ans[i]) { cout << "->\n"; } else { cout << "<-\n"; } } }