class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.w: C = 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.v: B = None
        self.t: C = None
        self.txt = txt

n = A("n")
k = B("k")
d = C("d")
b = C("b")

n.z = k
n.w = b
k.o = b
d.v = k
d.t = b
b.v = k
b.t = d
assert b.v.o.t.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.w: C = 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.v: B = None
        self.t: C = None
        self.txt = txt

n = A("n")
k = B("k")
d = C("d")
b = C("b")

n.z = k
n.w = b
k.o = b
d.v = k
d.t = b
b.v = k
b.t = d
assert b.v.o.t.txt == "d"