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

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

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

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

h = A("h")
i = B("i")
c = C("c")
m = D("m")
l = C("l")

h.w = m
h.u = m
i.z = c
c.p = m
m.u = i
l.p = m
assert c.p.u.z.p.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.u: D = None
        self.txt = txt

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

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

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

h = A("h")
i = B("i")
c = C("c")
m = D("m")
l = C("l")

h.w = m
h.u = m
i.z = c
c.p = m
m.u = i
l.p = m
assert c.p.u.z.p.txt == "m"