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

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

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

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

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

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

l.x = d
l.w = c
f.s = d
f.p = h
f.q = l
b.r = h
b.x = d
b.p = n
b.z = l
c.q = b
c.w = l
d.z = h
d.u = c
n.r = h
n.x = d
n.p = b
n.z = l
g.s = h
g.p = d
g.q = l
m.q = b
m.w = l
h.z = d
h.u = m
assert m.w.w.q.p.x.z.txt == "
class A:
    def __init__(self, txt: str):
        self.x: E = None
        self.w: D = None
        self.txt = txt

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

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

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

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

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

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