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

class B:
    def __init__(self, txt: str):
        self.u: A = None
        self.o: A = None
        self.q: E = None
        self.txt = txt

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

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

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

e = A("e")
h = B("h")
i = C("i")
c = D("c")
d = E("d")

e.o = d
e.t = c
h.u = e
h.o = e
h.q = d
i.w = e
c.p = e
d.z = c
d.u = e
d.r = i
assert c.p.o.z.p.t.txt == "
class A:
    def __init__(self, txt: str):
        self.o: E = None
        self.t: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: A = None
        self.o: A = None
        self.q: E = None
        self.txt = txt

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

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

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

e = A("e")
h = B("h")
i = C("i")
c = D("c")
d = E("d")

e.o = d
e.t = c
h.u = e
h.o = e
h.q = d
i.w = e
c.p = e
d.z = c
d.u = e
d.r = i
assert c.p.o.z.p.t.txt == "c"