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

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

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

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

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

e.t = m
e.z = l
l.v = c
l.o = c
l.x = m
l.q = m
a.s = e
m.r = a
h.v = c
h.x = c
h.q = m
h.o = m
c.r = a
assert a.s.t.r.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.z: B = None
        self.txt = txt

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

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

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

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

e.t = m
e.z = l
l.v = c
l.o = c
l.x = m
l.q = m
a.s = e
m.r = a
h.v = c
h.x = c
h.q = m
h.o = m
c.r = a
assert a.s.t.r.txt == "a"