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

k = A("k")
h = B("h")
e = C("e")
b = B("b")

k.u = h
h.t = b
e.t = k
b.t = h
assert b.t.t.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.u: 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.t: A = None
        self.txt = txt

k = A("k")
h = B("h")
e = C("e")
b = B("b")

k.u = h
h.t = b
e.t = k
b.t = h
assert b.t.t.t.t.txt == "b"