def f1(x): if not E[x]: return y, i, d = next(iter(E[x])) if d == 0: ans[i] = "->" else: ans[i] = "<-" E[x].remove((y,i,d)) E[y].remove((x,i,d^1)) D[x] -= 1 D[y] -= 1 if D[y] == 1: NV.remove(y) Q.append(y) N = int(input()) AB = [] E = [set() for _ in range(N)] D = [0] * N NV = set(range(N)) ans = [""] * N for i in range(N): a,b = map(int,input().split()) a -= 1 b -= 1 AB.append((a,b)) E[a].add((b, i, 0)) E[b].add((a, i, 1)) D[a] += 1 D[b] += 1 Q = [] for i in range(N): if D[i] == 1: Q.append(i) NV.remove(i) while Q: x = Q.pop() f1(x) if NV: x = next(iter(NV)) Q.append(x) y,i,d = next(iter(E[x])) NV.remove(x) NV.remove(y) E[x].remove((y, i, d)) E[y].remove((x, i, d ^ 1)) D[x] -= 1 D[y] -= 1 if d == 1: ans[i] = "->" else: ans[i] = "<-" while Q: x = Q.pop() f1(x) for a in ans: print(a)