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

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

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

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

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

j.s = m
j.t = m
j.o = f
j.v = i
m.x = a
f.q = m
f.w = m
f.o = a
i.w = a
i.r = f
a.w = i
a.r = f
assert m.x.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.o: C = None
        self.v: D = None
        self.t: B = None
        self.txt = txt

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

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

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

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

j.s = m
j.t = m
j.o = f
j.v = i
m.x = a
f.q = m
f.w = m
f.o = a
i.w = a
i.r = f
a.w = i
a.r = f
assert m.x.w.w.txt == "a"