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

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

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

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

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

i.x = b
i.u = b
i.w = l
b.v = h
h.r = l
h.z = b
l.v = b
l.y = h
l.r = h
m.v = b
m.y = h
m.r = h
c.x = b
c.u = b
c.w = l
assert c.u.v.z.v.z.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.u: B = None
        self.w: D = None
        self.txt = txt

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

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

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

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

i.x = b
i.u = b
i.w = l
b.v = h
h.r = l
h.z = b
l.v = b
l.y = h
l.r = h
m.v = b
m.y = h
m.r = h
c.x = b
c.u = b
c.w = l
assert c.u.v.z.v.z.txt == "b"