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

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

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

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

l = A("l")
d = B("d")
b = C("b")
m = D("m")

l.t = m
l.w = b
l.r = d
d.s = l
d.t = l
d.x = l
b.t = m
b.s = m
m.z = b
m.v = l
m.p = d
assert l.r.t.w.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.w: C = None
        self.r: B = None
        self.txt = txt

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

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

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

l = A("l")
d = B("d")
b = C("b")
m = D("m")

l.t = m
l.w = b
l.r = d
d.s = l
d.t = l
d.x = l
b.t = m
b.s = m
m.z = b
m.v = l
m.p = d
assert l.r.t.w.t.txt == "m"