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

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

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

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

n = A("n")
f = B("f")
a = C("a")
m = D("m")
g = C("g")
d = D("d")
j = D("j")
h = A("h")

n.s = d
n.o = j
f.w = m
f.t = g
a.q = n
a.p = n
a.v = f
a.o = j
m.v = d
m.q = d
m.z = j
m.y = h
g.q = h
g.p = n
g.v = f
g.o = d
d.v = j
d.z = j
d.q = j
d.y = h
j.v = d
j.q = d
j.z = m
j.y = n
h.s = j
h.o = d
assert m.v.v.z.z.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.o: D = None
        self.txt = txt

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

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

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

n = A("n")
f = B("f")
a = C("a")
m = D("m")
g = C("g")
d = D("d")
j = D("j")
h = A("h")

n.s = d
n.o = j
f.w = m
f.t = g
a.q = n
a.p = n
a.v = f
a.o = j
m.v = d
m.q = d
m.z = j
m.y = h
g.q = h
g.p = n
g.v = f
g.o = d
d.v = j
d.z = j
d.q = j
d.y = h
j.v = d
j.q = d
j.z = m
j.y = n
h.s = j
h.o = d
assert m.v.v.z.z.z.z.txt == "j"