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.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.z: A = None
        self.s: A = None
        self.r: B = None
        self.u: A = None
        self.q: E = None
        self.txt = txt

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

m.z = f
g.p = i
i.w = f
i.t = f
i.z = l
b.u = m
k.z = m
k.s = m
k.u = m
k.r = g
k.q = l
f.w = i
f.t = i
f.z = l
l.z = m
l.s = m
l.u = m
l.r = g
l.q = k
c.u = m
assert f.w.w.z.z.z.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.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.z: A = None
        self.s: A = None
        self.r: B = None
        self.u: A = None
        self.q: E = None
        self.txt = txt

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

m.z = f
g.p = i
i.w = f
i.t = f
i.z = l
b.u = m
k.z = m
k.s = m
k.u = m
k.r = g
k.q = l
f.w = i
f.t = i
f.z = l
l.z = m
l.s = m
l.u = m
l.r = g
l.q = k
c.u = m
assert f.w.w.z.z.z.txt == "f"