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

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

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

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

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

k = A("k")
c = B("c")
i = C("i")
g = D("g")
n = E("n")
a = D("a")

k.r = c
c.z = i
i.t = c
i.o = a
i.u = k
g.v = c
g.x = c
g.w = c
g.p = n
g.s = a
n.p = c
n.w = i
a.v = c
a.x = c
a.w = c
a.p = n
a.s = g
assert k.r.z.t.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.txt = txt

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

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

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

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

k = A("k")
c = B("c")
i = C("i")
g = D("g")
n = E("n")
a = D("a")

k.r = c
c.z = i
i.t = c
i.o = a
i.u = k
g.v = c
g.x = c
g.w = c
g.p = n
g.s = a
n.p = c
n.w = i
a.v = c
a.x = c
a.w = c
a.p = n
a.s = g
assert k.r.z.t.txt == "c"