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

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

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

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

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

e = A("e")
k = B("k")
f = C("f")
d = D("d")
a = E("a")

e.x = a
k.s = e
k.v = a
k.p = a
k.r = a
k.t = d
f.r = k
d.s = k
a.z = e
a.u = f
assert k.s.x.u.r.v.txt == "
class A:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

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

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

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

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

e = A("e")
k = B("k")
f = C("f")
d = D("d")
a = E("a")

e.x = a
k.s = e
k.v = a
k.p = a
k.r = a
k.t = d
f.r = k
d.s = k
a.z = e
a.u = f
assert k.s.x.u.r.v.txt == "a"