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

class B:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

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

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

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

d = A("d")
k = B("k")
l = C("l")
a = D("a")
j = E("j")

d.v = l
k.p = j
l.x = d
l.r = k
a.p = k
a.q = k
a.s = l
j.z = a
j.v = k
assert l.r.p.v.p.z.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

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

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

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

d = A("d")
k = B("k")
l = C("l")
a = D("a")
j = E("j")

d.v = l
k.p = j
l.x = d
l.r = k
a.p = k
a.q = k
a.s = l
j.z = a
j.v = k
assert l.r.p.v.p.z.txt == "a"