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

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

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

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

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

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

f.w = a
f.q = a
f.z = g
f.p = k
k.w = i
k.o = a
a.w = k
a.q = f
a.z = l
l.w = a
l.q = f
i.z = a
i.y = a
i.p = f
i.t = k
g.z = a
g.y = a
g.p = f
g.t = k
assert i.p.q.z.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.z: E = None
        self.q: C = None
        self.p: B = None
        self.txt = txt

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

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

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

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

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

f.w = a
f.q = a
f.z = g
f.p = k
k.w = i
k.o = a
a.w = k
a.q = f
a.z = l
l.w = a
l.q = f
i.z = a
i.y = a
i.p = f
i.t = k
g.z = a
g.y = a
g.p = f
g.t = k
assert i.p.q.z.w.txt == "a"