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

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

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

j = A("j")
c = B("c")
f = C("f")
k = A("k")
l = C("l")
d = B("d")
i = A("i")

j.o = l
c.s = i
c.x = k
c.v = k
f.s = l
k.o = l
l.s = f
d.s = i
d.x = i
d.v = i
i.o = l
assert c.x.o.s.s.s.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

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

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

j = A("j")
c = B("c")
f = C("f")
k = A("k")
l = C("l")
d = B("d")
i = A("i")

j.o = l
c.s = i
c.x = k
c.v = k
f.s = l
k.o = l
l.s = f
d.s = i
d.x = i
d.v = i
i.o = l
assert c.x.o.s.s.s.s.s.txt == "f"