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

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

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

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

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

d = A("d")
e = B("e")
b = C("b")
i = D("i")
n = E("n")

d.y = i
d.v = n
d.x = n
e.z = n
e.s = d
e.o = i
b.q = i
b.x = e
i.r = e
n.r = e
n.v = e
n.o = b
n.u = b
assert e.o.r.s.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.v: E = None
        self.x: E = None
        self.txt = txt

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

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

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

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

d = A("d")
e = B("e")
b = C("b")
i = D("i")
n = E("n")

d.y = i
d.v = n
d.x = n
e.z = n
e.s = d
e.o = i
b.q = i
b.x = e
i.r = e
n.r = e
n.v = e
n.o = b
n.u = b
assert e.o.r.s.txt == "d"