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

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

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

j = A("j")
a = B("a")
e = C("e")
n = C("n")
k = B("k")
m = A("m")
d = C("d")
h = C("h")
c = C("c")
l = A("l")

j.v = l
a.u = k
a.o = j
a.w = j
e.s = a
n.s = a
k.u = a
k.o = m
k.w = m
m.v = j
d.s = k
h.s = k
c.s = a
l.v = j
assert e.s.w.v.v.v.v.v.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: A = None
        self.txt = txt

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

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

j = A("j")
a = B("a")
e = C("e")
n = C("n")
k = B("k")
m = A("m")
d = C("d")
h = C("h")
c = C("c")
l = A("l")

j.v = l
a.u = k
a.o = j
a.w = j
e.s = a
n.s = a
k.u = a
k.o = m
k.w = m
m.v = j
d.s = k
h.s = k
c.s = a
l.v = j
assert e.s.w.v.v.v.v.v.v.v.txt == "l"