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

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

class C:
    def __init__(self, txt: str):
        self.u: C = None
        self.s: A = None
        self.x: A = None
        self.txt = txt

n = A("n")
c = B("c")
m = C("m")
g = B("g")
h = B("h")
b = C("b")
k = B("k")
e = B("e")
l = C("l")

n.v = b
c.r = k
m.u = b
m.s = n
m.x = n
g.r = h
h.r = k
b.u = l
b.s = n
b.x = n
k.r = h
e.r = k
l.u = b
l.s = n
l.x = n
assert m.u.s.v.u.s.v.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: C = None
        self.s: A = None
        self.x: A = None
        self.txt = txt

n = A("n")
c = B("c")
m = C("m")
g = B("g")
h = B("h")
b = C("b")
k = B("k")
e = B("e")
l = C("l")

n.v = b
c.r = k
m.u = b
m.s = n
m.x = n
g.r = h
h.r = k
b.u = l
b.s = n
b.x = n
k.r = h
e.r = k
l.u = b
l.s = n
l.x = n
assert m.u.s.v.u.s.v.u.u.u.txt == "l"