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

class B:
    def __init__(self, txt: str):
        self.w: A = None
        self.t: C = None
        self.r: E = None
        self.p: E = None
        self.v: C = None
        self.txt = txt

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

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

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

b = A("b")
k = B("k")
e = C("e")
d = D("d")
c = E("c")

b.t = k
k.w = b
k.t = e
k.v = e
k.r = c
k.p = c
e.u = b
d.s = c
d.y = k
d.q = k
c.p = k
c.t = b
assert k.t.u.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: A = None
        self.t: C = None
        self.r: E = None
        self.p: E = None
        self.v: C = None
        self.txt = txt

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

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

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

b = A("b")
k = B("k")
e = C("e")
d = D("d")
c = E("c")

b.t = k
k.w = b
k.t = e
k.v = e
k.r = c
k.p = c
e.u = b
d.s = c
d.y = k
d.q = k
c.p = k
c.t = b
assert k.t.u.t.txt == "k"