def edge(a,b,n,L=[]):

    for k in range(1,n+1):

        if a !=0 or b != 0:

            if a-k >= 0:

                entry = {(min(a,b) , max(a,b)) : (min(a-k,b) , max(a-k,b))}

                if entry not in L:

                    L.append(entry)

                    L = edge(a-k,b,n,L)

            if b-k >=0:

                entry = {(min(a,b) , max(a,b)) : (min(a,b-k) , max(a,b-k))}

                if entry not in L:

                    L.append(entry)

                    L = edge(a,b-k,n,L)

    return L

