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

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

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

d = A("d")
i = B("i")
m = C("m")
a = B("a")
f = C("f")
j = C("j")

d.v = i
d.q = i
d.t = j
i.w = a
m.v = i
m.y = i
m.x = a
a.w = i
f.v = i
f.x = i
f.y = i
j.v = i
j.x = a
j.y = a
assert a.w.w.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.t: C = None
        self.q: B = None
        self.txt = txt

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

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

d = A("d")
i = B("i")
m = C("m")
a = B("a")
f = C("f")
j = C("j")

d.v = i
d.q = i
d.t = j
i.w = a
m.v = i
m.y = i
m.x = a
a.w = i
f.v = i
f.x = i
f.y = i
j.v = i
j.x = a
j.y = a
assert a.w.w.w.w.txt == "a"