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

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

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

n = A("n")
l = B("l")
c = C("c")
j = A("j")
e = C("e")
m = B("m")
h = A("h")
f = B("f")

n.v = j
l.s = j
l.x = h
l.w = c
c.w = h
c.y = h
c.x = l
j.v = n
e.w = j
e.y = n
e.x = m
m.s = j
m.x = h
m.w = c
h.v = j
f.s = n
f.x = h
f.w = e
assert j.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.s: A = None
        self.x: A = None
        self.w: C = None
        self.txt = txt

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

n = A("n")
l = B("l")
c = C("c")
j = A("j")
e = C("e")
m = B("m")
h = A("h")
f = B("f")

n.v = j
l.s = j
l.x = h
l.w = c
c.w = h
c.y = h
c.x = l
j.v = n
e.w = j
e.y = n
e.x = m
m.s = j
m.x = h
m.w = c
h.v = j
f.s = n
f.x = h
f.w = e
assert j.v.v.v.v.v.txt == "n"