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

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

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

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

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

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

d.p = e
d.x = i
d.z = g
m.t = b
m.w = b
m.p = f
b.s = i
b.r = i
b.w = k
g.r = k
g.w = m
g.v = m
f.x = c
f.p = g
f.z = m
k.t = l
k.w = l
k.p = e
e.x = l
e.p = g
e.z = k
i.p = f
i.x = d
i.z = g
c.s = d
c.r = d
c.w = k
l.s = d
l.r = d
l.w = k
assert m.t.s.x.z.w.w.w.t.s.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.x: A = None
        self.z: D = None
        self.txt = txt

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

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

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

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

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

d.p = e
d.x = i
d.z = g
m.t = b
m.w = b
m.p = f
b.s = i
b.r = i
b.w = k
g.r = k
g.w = m
g.v = m
f.x = c
f.p = g
f.z = m
k.t = l
k.w = l
k.p = e
e.x = l
e.p = g
e.z = k
i.p = f
i.x = d
i.z = g
c.s = d
c.r = d
c.w = k
l.s = d
l.r = d
l.w = k
assert m.t.s.x.z.w.w.w.t.s.txt == "d"