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.txt = txt

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

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

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

a = A("a")
m = B("m")
j = C("j")
b = D("b")
n = E("n")
h = E("h")
g = E("g")

a.s = j
m.y = j
j.r = m
j.t = m
b.o = a
b.p = a
b.v = m
b.y = m
b.t = m
n.o = b
n.z = b
n.q = m
h.o = b
h.z = b
h.q = m
g.o = b
g.z = b
g.q = m
assert m.y.t.y.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.txt = txt

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

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

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

a = A("a")
m = B("m")
j = C("j")
b = D("b")
n = E("n")
h = E("h")
g = E("g")

a.s = j
m.y = j
j.r = m
j.t = m
b.o = a
b.p = a
b.v = m
b.y = m
b.t = m
n.o = b
n.z = b
n.q = m
h.o = b
h.z = b
h.q = m
g.o = b
g.z = b
g.q = m
assert m.y.t.y.txt == "j"