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

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

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

class D:
    def __init__(self, txt: str):
        self.o: A = None
        self.w: B = None
        self.t: E = None
        self.u: A = None
        self.s: A = None
        self.txt = txt

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

b = A("b")
a = B("a")
k = C("k")
e = D("e")
l = E("l")

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

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

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

class D:
    def __init__(self, txt: str):
        self.o: A = None
        self.w: B = None
        self.t: E = None
        self.u: A = None
        self.s: A = None
        self.txt = txt

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

b = A("b")
a = B("a")
k = C("k")
e = D("e")
l = E("l")

b.z = e
b.q = e
b.p = k
a.z = l
a.x = l
a.y = e
k.o = b
k.w = b
k.r = l
e.o = b
e.u = b
e.s = b
e.w = a
e.t = l
l.s = e
assert a.y.w.z.s.w.txt == "a"