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

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

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

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

c.t = m
m.x = c
n.v = a
a.x = c
assert a.x.t.x.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

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

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

c.t = m
m.x = c
n.v = a
a.x = c
assert a.x.t.x.t.txt == "m"