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

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

class C:
    def __init__(self, txt: str):
        self.z: E = None
        self.w: A = None
        self.v: A = None
        self.y: A = None
        self.txt = txt

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

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

c = A("c")
a = B("a")
e = C("e")
i = D("i")
n = E("n")

c.r = i
a.r = n
a.s = n
a.x = e
a.w = c
e.z = n
e.w = c
e.v = c
e.y = c
i.o = n
n.y = c
assert e.z.y.r.o.y.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.z: E = None
        self.w: A = None
        self.v: A = None
        self.y: A = None
        self.txt = txt

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

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

c = A("c")
a = B("a")
e = C("e")
i = D("i")
n = E("n")

c.r = i
a.r = n
a.s = n
a.x = e
a.w = c
e.z = n
e.w = c
e.v = c
e.y = c
i.o = n
n.y = c
assert e.z.y.r.o.y.txt == "c"