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

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

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

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

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

e = A("e")
m = B("m")
j = C("j")
h = D("h")
c = E("c")

e.x = h
m.x = j
j.u = h
j.o = m
j.z = e
h.o = c
h.x = j
c.v = m
c.p = h
assert h.o.v.x.z.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

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

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

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

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

e = A("e")
m = B("m")
j = C("j")
h = D("h")
c = E("c")

e.x = h
m.x = j
j.u = h
j.o = m
j.z = e
h.o = c
h.x = j
c.v = m
c.p = h
assert h.o.v.x.z.txt == "e"