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

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

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

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

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

a = A("a")
l = B("l")
j = C("j")
b = D("b")
h = E("h")

a.x = h
l.r = j
j.p = h
j.s = h
j.z = l
b.o = h
b.z = h
h.x = b
assert b.z.x.o.txt == "
class A:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

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

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

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

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

a = A("a")
l = B("l")
j = C("j")
b = D("b")
h = E("h")

a.x = h
l.r = j
j.p = h
j.s = h
j.z = l
b.o = h
b.z = h
h.x = b
assert b.z.x.o.txt == "h"