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

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

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

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

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

d = A("d")
e = B("e")
a = C("a")
j = D("j")
b = E("b")
i = C("i")
h = A("h")

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

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

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

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

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

d = A("d")
e = B("e")
a = C("a")
j = D("j")
b = E("b")
i = C("i")
h = A("h")

d.o = h
d.x = b
e.s = a
a.y = e
a.t = b
j.r = a
b.z = e
i.y = e
i.t = b
h.o = d
h.x = b
assert d.o.x.z.txt == "e"