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

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

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

n = A("n")
j = B("j")
a = C("a")

n.y = j
j.y = a
a.w = j
assert j.y.w.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

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

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

n = A("n")
j = B("j")
a = C("a")

n.y = j
j.y = a
a.w = j
assert j.y.w.y.txt == "a"