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

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

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

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

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

d = A("d")
f = B("f")
l = C("l")
c = D("c")
e = E("e")
m = D("m")
g = A("g")
b = C("b")
h = E("h")

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

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

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

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

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

d = A("d")
f = B("f")
l = C("l")
c = D("c")
e = E("e")
m = D("m")
g = A("g")
b = C("b")
h = E("h")

d.z = g
d.p = l
d.r = l
f.y = c
f.s = g
l.w = d
l.o = d
l.p = d
l.u = g
c.z = g
c.s = g
c.y = f
e.q = h
m.z = d
m.s = d
m.y = f
g.z = d
g.p = l
g.r = l
b.w = g
b.p = g
b.o = d
b.u = d
h.q = e
assert l.p.z.z.txt == "d"