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

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

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

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

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

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

m.s = g
m.o = d
b.r = h
b.x = g
b.u = f
g.r = c
g.s = k
g.v = i
g.t = m
h.p = k
h.v = b
h.o = b
h.z = m
f.o = d
f.w = n
i.o = d
i.w = n
n.r = c
n.x = g
n.u = i
d.s = g
d.o = m
k.o = m
k.w = b
c.p = k
c.v = n
c.o = b
c.z = m
assert k.o.s.s.o.o.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.o: A = None
        self.txt = txt

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

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

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

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

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

m.s = g
m.o = d
b.r = h
b.x = g
b.u = f
g.r = c
g.s = k
g.v = i
g.t = m
h.p = k
h.v = b
h.o = b
h.z = m
f.o = d
f.w = n
i.o = d
i.w = n
n.r = c
n.x = g
n.u = i
d.s = g
d.o = m
k.o = m
k.w = b
c.p = k
c.v = n
c.o = b
c.z = m
assert k.o.s.s.o.o.o.o.txt == "d"