N=int(input()) D=[0]*N;DD=[[] for _ in range(N)] A=[];B=[] for i in range(N): u,v=map(int,input().split()) u-=1;v-=1 A.append((u,v)) D[u]+=1;D[v]+=1 DD[u].append((v,i)) DD[v].append((u,i)) V=[-1]*N from collections import deque d=deque() for i in range(N): if D[i]==1: d.append(i) while d: now=d.popleft() for nex,i in DD[now]: if V[nex]==1: continue B.append((now,nex)) D[now]-=1;D[nex]-=1 if D[nex]==1: d.append(nex) V[now]=1 F=[[] for i in range(N)] for u,v in B: F[u].append(v) for i in range(N): F[i]=set(F[i]) ans=[0]*N for i in range(N): u,v=A[i] if v in F[u]: ans[i]=1 if u in F[v]: ans[i]=-1 d=deque();f=0;V=[1]*N for i in range(N): if D[i]==2 and f==0: g=i;f=1 if D[i]==2: V[i]=-1 for nex,i in DD[g]: if V[nex]==-1: s=nex break #print(V,s,g,DD) FF=[[] for i in range(N)] FF[g].append(s) #print('FF',FF) d.append(s) #print(d,s,g) while d: now=d.popleft() #print(now,DD[now]) for nex,i in DD[now]: if now==s and nex==g: continue if V[nex]==-1: V[now]=1 FF[now].append(nex) d.append(nex) for i in range(N): FF[i]=set(FF[i]) for i in range(N): if ans[i]==0: u,v=A[i] if u in FF[v]: ans[i]=1 else: ans[i]=-1 for i in ans: if i==-1: print('<-') else: print('->')