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

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

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

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

n = A("n")
m = B("m")
c = C("c")
k = D("k")
g = A("g")
d = A("d")
h = A("h")
e = D("e")
a = B("a")
b = B("b")

n.w = a
n.v = c
m.q = c
c.s = a
c.o = d
c.w = k
k.s = c
k.w = c
k.q = c
k.z = e
g.w = b
g.v = c
d.w = b
d.v = c
h.w = a
h.v = c
e.s = c
e.w = c
e.q = c
e.z = k
a.q = c
b.q = c
assert h.v.w.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.v: C = None
        self.txt = txt

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

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

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

n = A("n")
m = B("m")
c = C("c")
k = D("k")
g = A("g")
d = A("d")
h = A("h")
e = D("e")
a = B("a")
b = B("b")

n.w = a
n.v = c
m.q = c
c.s = a
c.o = d
c.w = k
k.s = c
k.w = c
k.q = c
k.z = e
g.w = b
g.v = c
d.w = b
d.v = c
h.w = a
h.v = c
e.s = c
e.w = c
e.q = c
e.z = k
a.q = c
b.q = c
assert h.v.w.z.z.txt == "k"