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

class B:
    def __init__(self, txt: str):
        self.q: C = 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.p: B = None
        self.w: C = None
        self.txt = txt

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

k = A("k")
a = B("a")
f = C("f")
l = D("l")
c = E("c")
n = A("n")
e = C("e")

k.y = c
k.z = e
a.q = e
f.x = c
l.p = a
l.w = e
c.x = l
n.y = c
n.z = e
e.x = c
assert l.w.x.x.w.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.y: E = None
        self.z: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: C = 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.p: B = None
        self.w: C = None
        self.txt = txt

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

k = A("k")
a = B("a")
f = C("f")
l = D("l")
c = E("c")
n = A("n")
e = C("e")

k.y = c
k.z = e
a.q = e
f.x = c
l.p = a
l.w = e
c.x = l
n.y = c
n.z = e
e.x = c
assert l.w.x.x.w.x.x.txt == "l"