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

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

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

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

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

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

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

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

n.r = h
h.x = i
i.s = h
assert n.r.x.s.txt == "h"