class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.v: C = None
        self.s: D = None
        self.w: C = 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.z: C = None
        self.o: D = None
        self.q: D = None
        self.y: D = None
        self.txt = txt

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

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

h.t = l
h.s = l
h.v = i
h.w = i
j.x = l
i.z = n
i.o = l
i.q = l
i.y = l
l.q = k
k.x = l
n.z = i
n.o = l
n.q = l
n.y = l
assert j.x.q.x.q.x.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.v: C = None
        self.s: D = None
        self.w: C = 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.z: C = None
        self.o: D = None
        self.q: D = None
        self.y: D = None
        self.txt = txt

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

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

h.t = l
h.s = l
h.v = i
h.w = i
j.x = l
i.z = n
i.o = l
i.q = l
i.y = l
l.q = k
k.x = l
n.z = i
n.o = l
n.q = l
n.y = l
assert j.x.q.x.q.x.txt == "l"