I,J,R=input,int,range N=J(I()) M=R(N) E,V=[[] for n in M],[set() for n in M] for n in M: X=I().split() E[n]=[J(X[0])-1,J(X[1])-1,0] for i in R(2):V[E[n][i]].add(n) for n in M: v=n while len(V[v])==1: e=V[v].pop() i=v==E[e][0] w,E[e][2]=E[e][i],i V[w].remove(e) v=w for v in M: while len(V[v]): e=V[v].pop() i=v==E[e][0] w,E[e][2]=E[e][i],i V[w].remove(e) v=w for n in M:print("->"if E[n][2] else"<-")