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

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

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

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

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

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

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

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

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

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

k.t = l
k.z = m
k.o = m
l.x = k
l.u = j
l.z = h
h.s = m
j.y = h
m.t = i
m.z = k
m.o = k
i.x = k
i.u = j
i.z = h
assert h.s.t.z.s.txt == "m"