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

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

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

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

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

j = A("j")
k = B("k")
a = C("a")
e = D("e")
n = E("n")

j.x = n
j.r = e
k.y = n
k.v = a
k.z = a
k.r = a
a.r = e
a.s = e
e.r = n
n.v = a
n.u = j
assert j.x.v.s.txt == "
class A:
    def __init__(self, txt: str):
        self.x: E = None
        self.r: D = None
        self.txt = txt

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

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

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

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

j = A("j")
k = B("k")
a = C("a")
e = D("e")
n = E("n")

j.x = n
j.r = e
k.y = n
k.v = a
k.z = a
k.r = a
a.r = e
a.s = e
e.r = n
n.v = a
n.u = j
assert j.x.v.s.txt == "e"