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

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: E = None
        self.v: D = None
        self.txt = txt

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

d.s = b
d.r = g
m.w = d
m.p = l
m.o = b
l.x = a
l.w = a
l.p = a
l.r = g
l.y = d
k.u = n
a.s = h
a.v = g
n.w = d
n.p = b
n.o = b
b.x = a
b.r = g
b.y = d
b.w = h
b.p = h
g.u = m
h.s = a
h.v = k
assert k.u.w.s.y.r.u.p.r.u.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.r: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: E = None
        self.v: D = None
        self.txt = txt

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

d.s = b
d.r = g
m.w = d
m.p = l
m.o = b
l.x = a
l.w = a
l.p = a
l.r = g
l.y = d
k.u = n
a.s = h
a.v = g
n.w = d
n.p = b
n.o = b
b.x = a
b.r = g
b.y = d
b.w = h
b.p = h
g.u = m
h.s = a
h.v = k
assert k.u.w.s.y.r.u.p.r.u.txt == "m"