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

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

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

n = A("n")
a = B("a")
l = C("l")
j = C("j")
h = A("h")
c = A("c")
f = B("f")
m = C("m")
i = B("i")
d = B("d")

n.o = c
a.v = m
a.z = n
a.w = j
l.p = i
l.q = j
j.p = a
j.q = m
h.o = c
c.o = n
f.v = j
f.z = n
f.w = l
m.p = f
m.q = j
i.v = j
i.w = j
i.z = c
d.v = l
d.z = c
d.w = j
assert n.o.o.o.o.o.o.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.txt = txt

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

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

n = A("n")
a = B("a")
l = C("l")
j = C("j")
h = A("h")
c = A("c")
f = B("f")
m = C("m")
i = B("i")
d = B("d")

n.o = c
a.v = m
a.z = n
a.w = j
l.p = i
l.q = j
j.p = a
j.q = m
h.o = c
c.o = n
f.v = j
f.z = n
f.w = l
m.p = f
m.q = j
i.v = j
i.w = j
i.z = c
d.v = l
d.z = c
d.w = j
assert n.o.o.o.o.o.o.o.o.txt == "n"