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

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

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

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

d = A("d")
i = B("i")
j = C("j")
a = D("a")
m = B("m")
f = B("f")

d.t = m
d.s = i
i.o = d
i.s = d
i.y = j
i.z = j
j.o = d
j.v = d
a.s = m
m.o = d
m.s = d
m.y = j
m.z = j
f.o = d
f.s = d
f.y = j
f.z = j
assert d.t.o.s.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.s: B = None
        self.txt = txt

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

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

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

d = A("d")
i = B("i")
j = C("j")
a = D("a")
m = B("m")
f = B("f")

d.t = m
d.s = i
i.o = d
i.s = d
i.y = j
i.z = j
j.o = d
j.v = d
a.s = m
m.o = d
m.s = d
m.y = j
m.z = j
f.o = d
f.s = d
f.y = j
f.z = j
assert d.t.o.s.txt == "i"