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

class B:
    def __init__(self, txt: str):
        self.z: E = None
        self.t: D = None
        self.s: D = None
        self.w: C = None
        self.txt = txt

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

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

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

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

l.v = g
a.z = g
a.t = j
a.s = j
a.w = k
k.q = g
j.r = a
g.r = j
assert k.q.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.v: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: E = None
        self.t: D = None
        self.s: D = None
        self.w: C = None
        self.txt = txt

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

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

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

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

l.v = g
a.z = g
a.t = j
a.s = j
a.w = k
k.q = g
j.r = a
g.r = j
assert k.q.r.r.txt == "a"