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

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

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

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

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

e.z = b
e.q = b
e.s = d
e.v = c
b.s = c
b.q = d
b.w = d
b.v = e
c.u = b
d.o = c
assert b.s.u.s.u.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.q: B = None
        self.s: D = None
        self.v: C = None
        self.txt = txt

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

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

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

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

e.z = b
e.q = b
e.s = d
e.v = c
b.s = c
b.q = d
b.w = d
b.v = e
c.u = b
d.o = c
assert b.s.u.s.u.txt == "b"