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

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

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

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

l = A("l")
k = B("k")
m = C("m")
e = D("e")

l.y = e
l.u = e
k.x = l
k.s = e
m.w = e
m.s = l
m.u = k
e.u = k
e.z = m
e.r = m
assert l.y.u.s.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.u: D = None
        self.txt = txt

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

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

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

l = A("l")
k = B("k")
m = C("m")
e = D("e")

l.y = e
l.u = e
k.x = l
k.s = e
m.w = e
m.s = l
m.u = k
e.u = k
e.z = m
e.r = m
assert l.y.u.s.txt == "e"