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

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

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

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

d = A("d")
h = B("h")
c = C("c")
k = D("k")

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

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

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

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

d = A("d")
h = B("h")
c = C("c")
k = D("k")

d.s = k
d.o = k
d.t = k
h.u = k
c.x = h
c.w = d
c.q = d
k.o = d
k.y = d
k.v = c
k.z = c
assert k.z.x.u.txt == "k"