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

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

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

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

h = A("h")
e = B("e")
l = C("l")
j = D("j")

h.z = e
h.q = l
h.o = l
h.s = j
e.s = j
l.q = h
j.w = l
assert e.s.w.q.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.q: C = None
        self.o: C = None
        self.s: D = None
        self.txt = txt

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

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

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

h = A("h")
e = B("e")
l = C("l")
j = D("j")

h.z = e
h.q = l
h.o = l
h.s = j
e.s = j
l.q = h
j.w = l
assert e.s.w.q.z.txt == "e"