from collections import deque



class GrapheOriente:

    def __init__(self):

        self.Liste = {}



    def addArete(self, u, v):

        if v not in self.Liste:

            self.Liste[v] = []



        if u not in self.Liste:

            self.Liste[u] = []



        self.Liste[u].append(v)

        #self.Liste[v].append(u) <- pour rendre le graphe orienté, on supprime cette ligne



    def chemins(self,start,end):

        pile = deque()

        pile.append((start, [start]))

        liste_chemins = []



        while pile:

            (S, path) = pile.pop()

            list_nodes = [n for n in self.Liste[S] if n not in path]

            for i in list_nodes:

                if i == end:

                    liste_chemins.append(path + [i])

                    chemins = True

                else:

                    pile.append((i, path + [i]))



        if chemins:

            print("\nListe des chemins de '"+start+"' vers '"+end+"' : ")

            for i in liste_chemins:

                print(i)

        else:

            print("Il n'y a aucun chemin allant de '"+start+"' vers '"+end+"'.")





"""

"""



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



"""

"""



G = GrapheOriente()

L = edge(3,3,2)

for i in L:

    for key, value in i.items():

        s = str(key[0])+str(key[1])

        e = str(value[0])+str(value[1])

        G.addArete( s , e )



for key,value in G.Liste.items():

    print(key,":",value)



"""

"""



G.chemins('33','00')

