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

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

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

class D:
    def __init__(self, txt: str):
        self.v: B = None
        self.t: C = None
        self.q: E = None
        self.o: E = None
        self.txt = txt

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

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

m.s = f
j.y = h
j.z = h
j.s = m
j.o = m
j.u = f
h.o = m
d.v = j
d.t = f
d.q = b
d.o = i
i.y = b
i.q = b
i.r = f
i.u = m
k.y = h
k.s = m
k.o = m
k.z = f
k.u = f
b.y = i
b.q = i
b.r = f
b.u = m
f.o = m
assert b.u.s.o.s.o.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.v: B = None
        self.t: C = None
        self.q: E = None
        self.o: E = None
        self.txt = txt

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

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

m.s = f
j.y = h
j.z = h
j.s = m
j.o = m
j.u = f
h.o = m
d.v = j
d.t = f
d.q = b
d.o = i
i.y = b
i.q = b
i.r = f
i.u = m
k.y = h
k.s = m
k.o = m
k.z = f
k.u = f
b.y = i
b.q = i
b.r = f
b.u = m
f.o = m
assert b.u.s.o.s.o.txt == "m"