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

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

class C:
    def __init__(self, txt: str):
        self.s: B = None
        self.p: E = None
        self.txt = txt

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

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

a = A("a")
e = B("e")
m = C("m")
g = D("g")
h = E("h")
f = B("f")
n = B("n")
d = A("d")
j = D("j")
i = B("i")

a.x = m
e.y = h
m.s = i
m.p = h
g.u = i
g.x = m
h.z = i
h.s = e
f.y = h
n.y = h
d.x = m
j.u = f
j.x = m
i.y = h
assert j.x.s.y.s.y.s.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: B = None
        self.p: E = None
        self.txt = txt

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

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

a = A("a")
e = B("e")
m = C("m")
g = D("g")
h = E("h")
f = B("f")
n = B("n")
d = A("d")
j = D("j")
i = B("i")

a.x = m
e.y = h
m.s = i
m.p = h
g.u = i
g.x = m
h.z = i
h.s = e
f.y = h
n.y = h
d.x = m
j.u = f
j.x = m
i.y = h
assert j.x.s.y.s.y.s.txt == "e"