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

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: D = None
        self.t: C = None
        self.q: A = None
        self.w: A = None
        self.x: A = None
        self.txt = txt

l = A("l")
c = B("c")
n = C("n")
j = D("j")
e = E("e")

l.q = c
l.r = n
c.r = l
n.s = c
n.w = e
j.q = l
j.z = e
j.y = e
e.u = j
e.t = n
e.q = l
e.w = l
e.x = l
assert l.q.r.q.r.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.r: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: D = None
        self.t: C = None
        self.q: A = None
        self.w: A = None
        self.x: A = None
        self.txt = txt

l = A("l")
c = B("c")
n = C("n")
j = D("j")
e = E("e")

l.q = c
l.r = n
c.r = l
n.s = c
n.w = e
j.q = l
j.z = e
j.y = e
e.u = j
e.t = n
e.q = l
e.w = l
e.x = l
assert l.q.r.q.r.q.txt == "c"