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

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

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

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

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

b = A("b")
k = B("k")
l = C("l")
i = D("i")
n = E("n")

b.w = l
k.y = b
k.o = n
l.x = n
l.r = n
l.o = b
l.z = k
i.q = n
n.s = l
n.w = l
n.q = l
n.p = i
assert k.o.q.z.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

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

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

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

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

b = A("b")
k = B("k")
l = C("l")
i = D("i")
n = E("n")

b.w = l
k.y = b
k.o = n
l.x = n
l.r = n
l.o = b
l.z = k
i.q = n
n.s = l
n.w = l
n.q = l
n.p = i
assert k.o.q.z.txt == "k"