class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.v: D = None
        self.t: D = None
        self.u: B = None
        self.txt = txt

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

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

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

h = A("h")
l = B("l")
i = C("i")
a = D("a")

h.w = a
h.v = a
h.t = a
h.u = l
l.x = a
i.s = l
a.s = i
a.y = i
a.o = l
a.u = l
assert a.y.s.x.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.v: D = None
        self.t: D = None
        self.u: B = None
        self.txt = txt

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

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

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

h = A("h")
l = B("l")
i = C("i")
a = D("a")

h.w = a
h.v = a
h.t = a
h.u = l
l.x = a
i.s = l
a.s = i
a.y = i
a.o = l
a.u = l
assert a.y.s.x.txt == "a"