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

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

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

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

k = A("k")
j = B("j")
d = C("d")
a = D("a")
h = C("h")

k.s = a
k.w = j
j.y = k
j.o = k
j.u = d
j.x = a
d.z = k
d.u = h
d.y = a
a.v = h
a.y = k
a.o = j
h.z = k
h.u = d
h.y = a
assert j.x.v.u.z.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.w: B = None
        self.txt = txt

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

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

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

k = A("k")
j = B("j")
d = C("d")
a = D("a")
h = C("h")

k.s = a
k.w = j
j.y = k
j.o = k
j.u = d
j.x = a
d.z = k
d.u = h
d.y = a
a.v = h
a.y = k
a.o = j
h.z = k
h.u = d
h.y = a
assert j.x.v.u.z.txt == "k"