You have a set of dominoes. Each domino is a rectangular tile with a line dividing its face into two square ends. Can you put all dominoes in a line one by one from left to right so that any two dominoes touched with the sides that had the same number of points? You can rotate the dominoes, changing the left and the right side (domino "1-4" turns into "4-1").
The first line contains number *n* (1  ≤  *n*  ≤  100). Next *n* lines contains the dominoes. Each of these lines contains two numbers — the number of points (spots) on the left and the right half, correspondingly. The numbers of points (spots) are non-negative integers from 0 to 6.
def euler(i):
    s = [(i,0)]
    ans = []
    while s:
        i,e = s[-1]
        if degree[i]==0:
            ans.append(e)
            s.pop()
        for j,e in graph[i]:
            if vis[abs(e)]==0:
                degree[i]-=1
                degree[j]-=1
                vis[abs(e)]=1
                s.append((j, e))
                break
    ans.reverse()
    for i in ans:
        if i<0:
            print(-i,"-")
        elif i>0:
            print(i, "+")



n = int(input())
degree = [0]*7
vis    = [0]*(n+1)
graph = [[] for _ in range(7)]
for i in range(1,1+n):
    x,y = map(int, input().split())
    graph[x].append((y,  i))
    graph[y].append((x, -i))
    degree[x]+=1
    degree[y]+=1

odd  =0
start=0
for i in range(0,7):
    if degree[i]%2==1:
        odd+=1
        start=i


if odd not in [0,2]:
    print("Impossible")
else:
    euler(start)
