class A:
    def __init__(self, txt: str):
        self.o: C = 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.s: A = None
        self.txt = txt

h = A("h")
d = B("d")
j = C("j")
a = C("a")
n = C("n")
l = B("l")

h.o = j
d.o = l
j.s = h
a.s = h
n.s = h
l.o = d
assert l.o.o.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = 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.s: A = None
        self.txt = txt

h = A("h")
d = B("d")
j = C("j")
a = C("a")
n = C("n")
l = B("l")

h.o = j
d.o = l
j.s = h
a.s = h
n.s = h
l.o = d
assert l.o.o.o.o.txt == "l"