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

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

class C:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

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

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

j = A("j")
d = B("d")
c = C("c")
e = D("e")
m = E("m")

j.r = e
j.s = m
j.v = m
d.t = j
c.x = m
e.s = m
m.o = j
assert e.s.o.r.s.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.s: E = None
        self.v: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

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

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

j = A("j")
d = B("d")
c = C("c")
e = D("e")
m = E("m")

j.r = e
j.s = m
j.v = m
d.t = j
c.x = m
e.s = m
m.o = j
assert e.s.o.r.s.txt == "m"