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

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

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

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

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

e.z = b
e.s = m
a.o = d
l.x = e
l.o = b
b.w = a
b.v = a
b.u = l
b.t = e
d.o = h
i.x = e
i.o = b
h.o = a
m.z = b
m.s = e
assert e.s.z.u.x.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.s: A = None
        self.txt = txt

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

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

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

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

e.z = b
e.s = m
a.o = d
l.x = e
l.o = b
b.w = a
b.v = a
b.u = l
b.t = e
d.o = h
i.x = e
i.o = b
h.o = a
m.z = b
m.s = e
assert e.s.z.u.x.z.txt == "b"