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

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

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

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

n.t = m
n.v = m
n.s = a
m.w = a
a.o = m
assert m.w.o.w.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.s: C = None
        self.v: B = None
        self.txt = txt

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

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

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

n.t = m
n.v = m
n.s = a
m.w = a
a.o = m
assert m.w.o.w.txt == "a"