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

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

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

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

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

d = A("d")
l = B("l")
f = C("f")
a = D("a")
m = E("m")
b = E("b")
h = B("h")

d.w = f
d.v = a
l.s = h
l.w = d
l.x = f
f.p = h
f.t = d
a.u = b
a.q = d
m.t = b
m.p = b
m.v = a
m.z = f
b.t = m
b.p = m
b.v = a
b.z = f
h.s = l
h.w = d
h.x = f
assert m.z.p.w.v.u.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.v: D = None
        self.txt = txt

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

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

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

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

d = A("d")
l = B("l")
f = C("f")
a = D("a")
m = E("m")
b = E("b")
h = B("h")

d.w = f
d.v = a
l.s = h
l.w = d
l.x = f
f.p = h
f.t = d
a.u = b
a.q = d
m.t = b
m.p = b
m.v = a
m.z = f
b.t = m
b.p = m
b.v = a
b.z = f
h.s = l
h.w = d
h.x = f
assert m.z.p.w.v.u.txt == "b"