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

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

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

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

e = A("e")
h = B("h")
d = C("d")
m = D("m")
l = A("l")
a = A("a")

e.x = h
e.u = h
e.p = m
h.x = m
d.z = e
d.y = m
d.v = m
m.o = h
m.z = h
l.x = h
l.u = h
l.p = m
a.x = h
a.u = h
a.p = m
assert l.p.o.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.p: D = None
        self.u: B = None
        self.txt = txt

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

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

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

e = A("e")
h = B("h")
d = C("d")
m = D("m")
l = A("l")
a = A("a")

e.x = h
e.u = h
e.p = m
h.x = m
d.z = e
d.y = m
d.v = m
m.o = h
m.z = h
l.x = h
l.u = h
l.p = m
a.x = h
a.u = h
a.p = m
assert l.p.o.x.txt == "m"