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

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

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

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

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

k = A("k")
b = B("b")
c = C("c")
i = D("i")
l = E("l")
n = C("n")
e = E("e")
f = B("f")
a = A("a")

k.z = l
k.v = n
k.q = n
b.p = k
c.r = i
c.w = e
i.r = b
i.u = c
i.s = e
i.w = n
l.o = f
l.y = b
n.r = i
n.w = l
e.o = b
e.y = b
f.p = a
a.z = l
a.v = c
a.q = c
assert b.p.z.o.p.v.w.o.p.q.txt == "
class A:
    def __init__(self, txt: str):
        self.z: E = None
        self.v: C = None
        self.q: C = None
        self.txt = txt

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

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

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

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

k = A("k")
b = B("b")
c = C("c")
i = D("i")
l = E("l")
n = C("n")
e = E("e")
f = B("f")
a = A("a")

k.z = l
k.v = n
k.q = n
b.p = k
c.r = i
c.w = e
i.r = b
i.u = c
i.s = e
i.w = n
l.o = f
l.y = b
n.r = i
n.w = l
e.o = b
e.y = b
f.p = a
a.z = l
a.v = c
a.q = c
assert b.p.z.o.p.v.w.o.p.q.txt == "n"