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

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

e = A("e")
l = B("l")
m = A("m")
b = B("b")
j = B("j")
c = A("c")

e.v = b
e.o = m
l.o = c
l.z = c
m.v = j
m.o = c
b.o = m
b.z = m
j.o = e
j.z = c
c.v = l
c.o = m
assert e.v.z.o.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.o: A = None
        self.txt = txt

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

e = A("e")
l = B("l")
m = A("m")
b = B("b")
j = B("j")
c = A("c")

e.v = b
e.o = m
l.o = c
l.z = c
m.v = j
m.o = c
b.o = m
b.z = m
j.o = e
j.z = c
c.v = l
c.o = m
assert e.v.z.o.v.txt == "l"