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

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

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

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

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

j.w = e
j.z = b
j.u = k
a.y = l
k.r = a
k.u = b
b.v = e
l.y = a
e.w = j
e.z = b
e.u = k
assert a.y.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.w: A = None
        self.z: D = None
        self.u: C = None
        self.txt = txt

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

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

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

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

j.w = e
j.z = b
j.u = k
a.y = l
k.r = a
k.u = b
b.v = e
l.y = a
e.w = j
e.z = b
e.u = k
assert a.y.y.y.y.txt == "a"