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

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

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

b = A("b")
l = B("l")
i = C("i")
d = B("d")
n = C("n")

b.q = i
b.v = l
l.o = n
i.z = d
d.o = n
n.z = l
assert b.v.o.z.o.z.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.v: B = None
        self.txt = txt

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

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

b = A("b")
l = B("l")
i = C("i")
d = B("d")
n = C("n")

b.q = i
b.v = l
l.o = n
i.z = d
d.o = n
n.z = l
assert b.v.o.z.o.z.txt == "l"