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

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

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

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

m.o = n
m.x = n
m.v = a
n.s = j
c.t = j
e.t = j
f.o = n
f.x = n
f.v = e
j.s = n
g.o = n
g.x = n
g.v = h
h.t = j
a.t = j
assert h.t.s.s.s.s.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.x: B = None
        self.v: C = None
        self.txt = txt

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

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

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

m.o = n
m.x = n
m.v = a
n.s = j
c.t = j
e.t = j
f.o = n
f.x = n
f.v = e
j.s = n
g.o = n
g.x = n
g.v = h
h.t = j
a.t = j
assert h.t.s.s.s.s.s.s.txt == "j"