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

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

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

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

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

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

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

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

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

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

l.r = b
l.w = b
l.z = m
l.u = m
m.w = h
m.o = h
n.o = m
n.y = m
n.x = h
b.w = h
h.o = m
h.y = m
h.x = n
assert h.x.x.y.txt == "m"