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

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

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

c = A("c")
j = B("j")
i = C("i")
f = B("f")
h = A("h")
a = C("a")
e = A("e")
d = B("d")

c.w = i
j.u = d
j.z = d
i.p = d
i.u = d
f.u = j
f.z = d
h.w = i
a.p = j
a.u = d
e.w = a
d.u = f
d.z = f
assert j.u.z.u.u.u.z.z.u.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

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

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

c = A("c")
j = B("j")
i = C("i")
f = B("f")
h = A("h")
a = C("a")
e = A("e")
d = B("d")

c.w = i
j.u = d
j.z = d
i.p = d
i.u = d
f.u = j
f.z = d
h.w = i
a.p = j
a.u = d
e.w = a
d.u = f
d.z = f
assert j.u.z.u.u.u.z.z.u.txt == "j"