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

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

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

k = A("k")
i = B("i")
n = C("n")
h = A("h")

k.t = i
i.r = k
n.s = i
h.t = i
assert i.r.t.r.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

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

k = A("k")
i = B("i")
n = C("n")
h = A("h")

k.t = i
i.r = k
n.s = i
h.t = i
assert i.r.t.r.t.txt == "i"