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

class B:
    def __init__(self, txt: str):
        self.r: D = None
        self.txt = txt

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

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

k = A("k")
j = B("j")
n = C("n")
g = D("g")
a = C("a")
f = B("f")
c = A("c")
i = A("i")
d = D("d")

k.z = j
j.r = d
n.o = k
n.s = a
n.v = a
n.w = g
g.y = n
a.o = i
a.s = n
a.v = n
a.w = g
f.r = g
c.z = f
i.z = f
d.y = a
assert n.o.z.r.y.s.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: D = None
        self.txt = txt

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

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

k = A("k")
j = B("j")
n = C("n")
g = D("g")
a = C("a")
f = B("f")
c = A("c")
i = A("i")
d = D("d")

k.z = j
j.r = d
n.o = k
n.s = a
n.v = a
n.w = g
g.y = n
a.o = i
a.s = n
a.v = n
a.w = g
f.r = g
c.z = f
i.z = f
d.y = a
assert n.o.z.r.y.s.txt == "n"