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

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

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

b = A("b")
l = B("l")
h = C("h")
d = C("d")
i = A("i")
m = C("m")
k = A("k")
g = C("g")
f = B("f")

b.s = f
l.o = f
h.v = b
d.v = b
i.s = l
m.v = i
k.s = f
g.v = b
f.o = l
assert k.s.o.o.o.o.o.o.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

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

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

b = A("b")
l = B("l")
h = C("h")
d = C("d")
i = A("i")
m = C("m")
k = A("k")
g = C("g")
f = B("f")

b.s = f
l.o = f
h.v = b
d.v = b
i.s = l
m.v = i
k.s = f
g.v = b
f.o = l
assert k.s.o.o.o.o.o.o.o.o.txt == "f"