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

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

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

class D:
    def __init__(self, txt: str):
        self.z: A = None
        self.txt = txt

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

b = A("b")
f = B("f")
a = C("a")
k = D("k")
n = E("n")
h = E("h")

b.w = h
b.s = a
b.p = f
b.y = k
f.y = h
a.w = b
k.z = b
n.z = k
n.r = k
n.v = k
h.z = k
h.r = k
h.v = k
assert k.z.w.z.txt == "
class A:
    def __init__(self, txt: str):
        self.w: E = None
        self.s: C = None
        self.p: B = None
        self.y: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.z: A = None
        self.txt = txt

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

b = A("b")
f = B("f")
a = C("a")
k = D("k")
n = E("n")
h = E("h")

b.w = h
b.s = a
b.p = f
b.y = k
f.y = h
a.w = b
k.z = b
n.z = k
n.r = k
n.v = k
h.z = k
h.r = k
h.v = k
assert k.z.w.z.txt == "k"