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

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

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

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

n.y = h
h.s = g
g.t = h
g.u = h
assert h.s.t.s.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

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

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

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

n.y = h
h.s = g
g.t = h
g.u = h
assert h.s.t.s.txt == "g"