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

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

class C:
    def __init__(self, txt: str):
        self.y: D = None
        self.p: A = None
        self.u: C = None
        self.x: B = None
        self.r: D = None
        self.txt = txt

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

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

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

b.z = d
b.w = d
d.z = k
d.u = b
j.y = e
j.r = e
j.p = b
j.u = k
j.x = d
e.o = d
e.u = j
i.y = e
i.p = b
k.y = e
k.r = e
k.p = b
k.u = j
k.x = d
assert j.x.u.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.w: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.y: D = None
        self.p: A = None
        self.u: C = None
        self.x: B = None
        self.r: D = None
        self.txt = txt

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

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

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

b.z = d
b.w = d
d.z = k
d.u = b
j.y = e
j.r = e
j.p = b
j.u = k
j.x = d
e.o = d
e.u = j
i.y = e
i.p = b
k.y = e
k.r = e
k.p = b
k.u = j
k.x = d
assert j.x.u.z.z.txt == "k"