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

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

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

class D:
    def __init__(self, txt: str):
        self.y: C = None
        self.z: A = None
        self.txt = txt

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

i.p = j
j.t = m
j.u = n
j.z = f
m.w = i
m.t = j
d.y = n
d.z = i
n.w = i
n.t = j
f.y = m
f.z = i
assert f.z.p.u.t.u.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.y: C = None
        self.z: A = None
        self.txt = txt

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

i.p = j
j.t = m
j.u = n
j.z = f
m.w = i
m.t = j
d.y = n
d.z = i
n.w = i
n.t = j
f.y = m
f.z = i
assert f.z.p.u.t.u.txt == "n"