class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.v: C = None
        self.txt = txt

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

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

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

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

j.t = m
j.v = l
k.w = j
k.x = j
k.t = e
m.o = k
m.q = e
m.z = e
e.t = l
h.o = k
h.q = e
h.z = e
l.o = k
l.q = e
l.z = e
assert k.w.v.z.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.v: C = None
        self.txt = txt

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

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

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

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

j.t = m
j.v = l
k.w = j
k.x = j
k.t = e
m.o = k
m.q = e
m.z = e
e.t = l
h.o = k
h.q = e
h.z = e
l.o = k
l.q = e
l.z = e
assert k.w.v.z.t.txt == "l"