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

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

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

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

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

j.x = i
j.u = m
j.s = m
j.z = f
f.r = j
b.y = f
b.v = f
b.t = i
m.p = i
m.v = f
i.p = m
i.v = f
assert m.p.p.p.v.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.u: D = None
        self.s: D = None
        self.z: B = None
        self.txt = txt

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

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

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

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

j.x = i
j.u = m
j.s = m
j.z = f
f.r = j
b.y = f
b.v = f
b.t = i
m.p = i
m.v = f
i.p = m
i.v = f
assert m.p.p.p.v.txt == "f"