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

class B:
    def __init__(self, txt: str):
        self.w: E = None
        self.q: E = None
        self.s: C = None
        self.p: E = None
        self.r: E = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.x: A = None
        self.txt = txt

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

l.z = h
a.w = i
a.q = c
a.p = c
a.r = c
a.s = h
h.o = m
h.z = m
h.r = i
m.s = i
m.t = a
c.x = l
i.x = l
assert l.z.z.t.s.o.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: E = None
        self.q: E = None
        self.s: C = None
        self.p: E = None
        self.r: E = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.x: A = None
        self.txt = txt

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

l.z = h
a.w = i
a.q = c
a.p = c
a.r = c
a.s = h
h.o = m
h.z = m
h.r = i
m.s = i
m.t = a
c.x = l
i.x = l
assert l.z.z.t.s.o.txt == "m"