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

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

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

class D:
    def __init__(self, txt: str):
        self.y: A = None
        self.txt = txt

j = A("j")
b = B("b")
e = C("e")
c = D("c")
d = A("d")

j.x = d
j.v = d
j.t = b
b.y = d
e.z = b
e.u = j
c.y = d
d.x = j
d.v = j
d.t = b
assert e.u.t.y.txt == "
class A:
    def __init__(self, txt: str):
        self.x: A = None
        self.v: A = None
        self.t: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.y: A = None
        self.txt = txt

j = A("j")
b = B("b")
e = C("e")
c = D("c")
d = A("d")

j.x = d
j.v = d
j.t = b
b.y = d
e.z = b
e.u = j
c.y = d
d.x = j
d.v = j
d.t = b
assert e.u.t.y.txt == "d"