#include typedef struct Edge { struct Edge *next; int v, id; } edge; int main() { int i, N, u, w, deg[200001] = {}; edge *adj[200001] = {}, e[400001], *p; scanf("%d", &N); for (i = 0; i < N; i++) { scanf("%d %d", &u, &w); e[i*2].v = w; e[i*2+1].v = u; e[i*2].id = i * 2; e[i*2+1].id = i * 2 + 1; e[i*2].next = adj[u]; e[i*2+1].next = adj[w]; adj[u] = &(e[i*2]); adj[w] = &(e[i*2+1]); deg[u]++; deg[w]++; } int ans[200001] = {}, q[200001], head = 0, tail = 0, x = 1, flag[200001] = {}; for (u = 1; u <= N; u++) if (deg[u] == 1) q[tail++] = u; while (tail < N) { for (; head < tail; head++) { u = q[head]; flag[u] = 1; for (p = adj[u]; p != NULL; p = p->next) if (ans[p->id / 2] == 0) break; if (p->id % 2 == 0) ans[p->id / 2] = 1; else ans[p->id / 2] = -1; w = p->v; if (flag[w] == 0) { deg[w]--; if (deg[w] == 1) q[tail++] = w; } } for (; x <= N && flag[x] != 0; x++); if (x <= N) q[tail++] = x; } for (i = 0; i < N; i++) { if (ans[i] == 1) printf("->\n"); else printf("<-\n"); } fflush(stdout); return 0; }