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

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: D = None
        self.z: A = None
        self.txt = txt

e = A("e")
k = B("k")
d = C("d")
i = D("i")
a = E("a")
j = B("j")
m = D("m")

e.t = m
e.y = a
k.x = d
d.o = a
d.s = e
i.p = e
i.y = j
i.o = d
a.p = i
a.z = e
j.x = d
m.p = e
m.y = k
m.o = d
assert e.t.y.x.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.y: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: D = None
        self.z: A = None
        self.txt = txt

e = A("e")
k = B("k")
d = C("d")
i = D("i")
a = E("a")
j = B("j")
m = D("m")

e.t = m
e.y = a
k.x = d
d.o = a
d.s = e
i.p = e
i.y = j
i.o = d
a.p = i
a.z = e
j.x = d
m.p = e
m.y = k
m.o = d
assert e.t.y.x.txt == "d"