class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.s: A = None
        self.y: D = None
        self.v: C = None
        self.txt = txt

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

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

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

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

h.z = a
h.y = a
h.s = l
h.v = j
i.w = h
j.u = a
a.v = i
a.r = i
l.z = a
l.y = a
l.s = h
l.v = j
assert h.v.u.v.w.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.s: A = None
        self.y: D = None
        self.v: C = None
        self.txt = txt

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

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

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

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

h.z = a
h.y = a
h.s = l
h.v = j
i.w = h
j.u = a
a.v = i
a.r = i
l.z = a
l.y = a
l.s = h
l.v = j
assert h.v.u.v.w.txt == "h"