class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.z: C = None
        self.w: D = None
        self.t: E = None
        self.x: D = None
        self.txt = txt

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

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

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

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

k = A("k")
a = B("a")
m = C("m")
j = D("j")
i = E("i")

k.y = m
k.z = m
k.w = j
k.x = j
k.t = i
a.p = i
a.w = i
a.q = m
m.x = k
j.w = i
j.r = m
i.z = a
i.t = a
i.w = j
assert k.z.x.t.w.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.z: C = None
        self.w: D = None
        self.t: E = None
        self.x: D = None
        self.txt = txt

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

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

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

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

k = A("k")
a = B("a")
m = C("m")
j = D("j")
i = E("i")

k.y = m
k.z = m
k.w = j
k.x = j
k.t = i
a.p = i
a.w = i
a.q = m
m.x = k
j.w = i
j.r = m
i.z = a
i.t = a
i.w = j
assert k.z.x.t.w.txt == "j"