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

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

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

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

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

h.q = f
h.z = k
h.u = j
l.t = k
l.w = k
l.z = j
l.x = j
k.y = f
k.o = l
f.s = h
j.t = k
j.w = k
j.z = l
j.x = l
assert l.x.t.y.s.z.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.z: C = None
        self.u: B = None
        self.txt = txt

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

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

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

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

h.q = f
h.z = k
h.u = j
l.t = k
l.w = k
l.z = j
l.x = j
k.y = f
k.o = l
f.s = h
j.t = k
j.w = k
j.z = l
j.x = l
assert l.x.t.y.s.z.txt == "k"