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

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

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

class D:
    def __init__(self, txt: str):
        self.y: C = None
        self.z: B = None
        self.o: A = None
        self.v: C = None
        self.r: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: C = None
        self.w: D = None
        self.o: C = None
        self.z: A = None
        self.s: A = None
        self.txt = txt

m = A("m")
n = B("n")
g = C("g")
c = D("c")
b = E("b")
d = C("d")

m.s = g
n.o = b
g.w = m
g.s = m
c.y = d
c.z = n
c.o = m
c.v = g
c.r = g
b.y = g
b.o = g
b.w = c
b.z = m
b.s = m
d.w = m
d.s = m
assert n.o.s.s.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.y: C = None
        self.z: B = None
        self.o: A = None
        self.v: C = None
        self.r: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: C = None
        self.w: D = None
        self.o: C = None
        self.z: A = None
        self.s: A = None
        self.txt = txt

m = A("m")
n = B("n")
g = C("g")
c = D("c")
b = E("b")
d = C("d")

m.s = g
n.o = b
g.w = m
g.s = m
c.y = d
c.z = n
c.o = m
c.v = g
c.r = g
b.y = g
b.o = g
b.w = c
b.z = m
b.s = m
d.w = m
d.s = m
assert n.o.s.s.s.s.txt == "g"