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

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

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

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

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

c = A("c")
f = B("f")
m = C("m")
e = D("e")
a = E("a")
d = E("d")
b = E("b")

c.o = f
f.u = m
m.y = e
m.z = e
m.t = e
m.s = c
m.u = f
e.q = d
a.t = d
d.t = a
b.t = d
assert c.o.u.s.o.u.y.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

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

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

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

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

c = A("c")
f = B("f")
m = C("m")
e = D("e")
a = E("a")
d = E("d")
b = E("b")

c.o = f
f.u = m
m.y = e
m.z = e
m.t = e
m.s = c
m.u = f
e.q = d
a.t = d
d.t = a
b.t = d
assert c.o.u.s.o.u.y.txt == "e"