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

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

class C:
    def __init__(self, txt: str):
        self.v: E = None
        self.txt = txt

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

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

k = A("k")
f = B("f")
l = C("l")
g = D("g")
m = E("m")
b = E("b")

k.z = l
f.p = l
f.q = l
f.u = g
f.y = g
l.v = b
g.o = m
g.s = f
g.y = f
g.u = k
g.w = k
m.y = k
m.z = g
b.y = k
b.z = g
assert l.v.y.z.v.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: E = None
        self.txt = txt

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

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

k = A("k")
f = B("f")
l = C("l")
g = D("g")
m = E("m")
b = E("b")

k.z = l
f.p = l
f.q = l
f.u = g
f.y = g
l.v = b
g.o = m
g.s = f
g.y = f
g.u = k
g.w = k
m.y = k
m.z = g
b.y = k
b.z = g
assert l.v.y.z.v.txt == "b"