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

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

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

h = A("h")
f = B("f")
n = C("n")
j = C("j")
b = B("b")

h.o = f
f.t = b
n.s = j
j.s = n
b.t = f
assert f.t.t.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

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

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

h = A("h")
f = B("f")
n = C("n")
j = C("j")
b = B("b")

h.o = f
f.t = b
n.s = j
j.s = n
b.t = f
assert f.t.t.t.t.txt == "f"