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

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

class C:
    def __init__(self, txt: str):
        self.y: D = None
        self.q: D = None
        self.z: B = None
        self.s: A = None
        self.u: E = None
        self.txt = txt

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

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

c = A("c")
h = B("h")
k = C("k")
i = D("i")
b = E("b")

c.o = h
h.w = b
h.q = i
k.y = i
k.q = i
k.z = h
k.s = c
k.u = b
i.r = h
i.w = b
b.v = h
b.x = k
b.z = k
assert h.w.v.q.r.q.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.y: D = None
        self.q: D = None
        self.z: B = None
        self.s: A = None
        self.u: E = None
        self.txt = txt

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

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

c = A("c")
h = B("h")
k = C("k")
i = D("i")
b = E("b")

c.o = h
h.w = b
h.q = i
k.y = i
k.q = i
k.z = h
k.s = c
k.u = b
i.r = h
i.w = b
b.v = h
b.x = k
b.z = k
assert h.w.v.q.r.q.txt == "i"