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

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

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

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

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

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

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

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

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

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

l.x = b
l.w = e
a.t = b
a.x = l
a.v = e
a.s = e
b.w = l
b.t = l
b.r = a
e.z = a
e.y = a
e.w = l
assert l.w.w.w.z.txt == "a"