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

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

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

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

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

a = A("a")
c = B("c")
e = C("e")
l = D("l")
k = E("k")

a.t = c
c.u = a
e.v = l
e.z = c
e.q = k
e.x = a
l.r = e
k.r = c
assert k.r.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.u: A = None
        self.txt = txt

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

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

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

a = A("a")
c = B("c")
e = C("e")
l = D("l")
k = E("k")

a.t = c
c.u = a
e.v = l
e.z = c
e.q = k
e.x = a
l.r = e
k.r = c
assert k.r.u.t.txt == "c"