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

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

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

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

j = A("j")
l = B("l")
d = C("d")
b = D("b")
k = B("k")

j.x = b
j.t = k
l.r = b
l.t = b
l.z = b
l.v = d
d.x = b
b.t = l
k.r = b
k.t = b
k.z = b
k.v = d
assert k.z.t.r.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.t: B = None
        self.txt = txt

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

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

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

j = A("j")
l = B("l")
d = C("d")
b = D("b")
k = B("k")

j.x = b
j.t = k
l.r = b
l.t = b
l.z = b
l.v = d
d.x = b
b.t = l
k.r = b
k.t = b
k.z = b
k.v = d
assert k.z.t.r.txt == "b"