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

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

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

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

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

j.w = c
j.z = a
g.o = a
g.y = j
a.t = j
c.o = m
c.s = f
f.o = a
f.y = j
d.w = c
d.z = a
m.o = c
m.s = g
assert a.t.w.s.o.t.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.z: C = None
        self.txt = txt

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

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

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

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

j.w = c
j.z = a
g.o = a
g.y = j
a.t = j
c.o = m
c.s = f
f.o = a
f.y = j
d.w = c
d.z = a
m.o = c
m.s = g
assert a.t.w.s.o.t.txt == "j"