class A:
    def __init__(self, txt: str):
        self.v: A = None
        self.o: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: A = None
        self.o: B = None
        self.txt = txt

e = A("e")
i = B("i")
d = A("d")
a = B("a")

e.v = d
e.o = a
i.u = e
i.o = a
d.v = e
d.o = i
a.u = e
a.o = i
assert d.v.o.u.o.txt == "
class A:
    def __init__(self, txt: str):
        self.v: A = None
        self.o: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: A = None
        self.o: B = None
        self.txt = txt

e = A("e")
i = B("i")
d = A("d")
a = B("a")

e.v = d
e.o = a
i.u = e
i.o = a
d.v = e
d.o = i
a.u = e
a.o = i
assert d.v.o.u.o.txt == "a"