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

class B:
    def __init__(self, txt: str):
        self.x: C = None
        self.u: C = None
        self.q: E = None
        self.p: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: A = None
        self.y: D = None
        self.o: D = None
        self.u: A = None
        self.w: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.s: A = None
        self.v: C = None
        self.o: D = None
        self.y: B = None
        self.q: B = None
        self.txt = txt

i = A("i")
a = B("a")
k = C("k")
m = D("m")
d = E("d")
f = E("f")
n = A("n")
c = D("c")

i.w = a
a.x = k
a.u = k
a.p = k
a.q = f
k.v = i
k.y = c
k.o = c
k.u = n
k.w = a
m.x = k
m.y = c
d.s = n
d.v = k
d.o = m
d.y = a
d.q = a
f.s = i
f.v = k
f.o = m
f.y = a
f.q = a
n.w = a
c.x = k
c.y = m
assert k.u.w.q.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: C = None
        self.u: C = None
        self.q: E = None
        self.p: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: A = None
        self.y: D = None
        self.o: D = None
        self.u: A = None
        self.w: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.s: A = None
        self.v: C = None
        self.o: D = None
        self.y: B = None
        self.q: B = None
        self.txt = txt

i = A("i")
a = B("a")
k = C("k")
m = D("m")
d = E("d")
f = E("f")
n = A("n")
c = D("c")

i.w = a
a.x = k
a.u = k
a.p = k
a.q = f
k.v = i
k.y = c
k.o = c
k.u = n
k.w = a
m.x = k
m.y = c
d.s = n
d.v = k
d.o = m
d.y = a
d.q = a
f.s = i
f.v = k
f.o = m
f.y = a
f.q = a
n.w = a
c.x = k
c.y = m
assert k.u.w.q.txt == "f"