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

class B:
    def __init__(self, txt: str):
        self.y: A = None
        self.q: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.u: C = None
        self.w: B = None
        self.r: A = None
        self.q: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: A = None
        self.r: B = None
        self.s: D = None
        self.x: D = None
        self.t: B = None
        self.txt = txt

k = A("k")
d = B("d")
j = C("j")
c = D("c")
i = E("i")

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

class B:
    def __init__(self, txt: str):
        self.y: A = None
        self.q: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.u: C = None
        self.w: B = None
        self.r: A = None
        self.q: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: A = None
        self.r: B = None
        self.s: D = None
        self.x: D = None
        self.t: B = None
        self.txt = txt

k = A("k")
d = B("d")
j = C("j")
c = D("c")
i = E("i")

k.o = j
d.y = k
d.q = j
j.v = d
j.t = d
j.s = k
j.x = k
j.z = i
c.u = j
c.q = j
c.w = d
c.r = k
i.u = k
i.r = d
i.t = d
i.s = c
i.x = c
assert k.o.t.q.txt == "j"